summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 15:18:17 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 15:18:17 +0000
commit6c4e6631acb0893ba00f035792e80942e2b00bd3 (patch)
tree2813210237c84fce72010ca1dff078a272770e03 /chrome/browser/autocomplete
parent8180e3ac5a503f0693fc550fe2163074de3cc7b2 (diff)
downloadchromium_src-6c4e6631acb0893ba00f035792e80942e2b00bd3.zip
chromium_src-6c4e6631acb0893ba00f035792e80942e2b00bd3.tar.gz
chromium_src-6c4e6631acb0893ba00f035792e80942e2b00bd3.tar.bz2
Adds some experimental stuff for tab preview: ability to determine max
screen position of popup and current url in omnibox. BUG=none TEST=none Review URL: http://codereview.chromium.org/3076040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55399 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc6
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h7
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.h1
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_model.h2
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view.h3
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc6
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.h1
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.h2
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm6
9 files changed, 32 insertions, 2 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 85eb29d..50321ba 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -127,6 +127,12 @@ void AutocompleteEditModel::RestoreState(const State& state) {
}
}
+GURL AutocompleteEditModel::CurrentURL() {
+ AutocompleteMatch match;
+ GetInfoForCurrentText(&match, NULL);
+ return match.destination_url;
+}
+
bool AutocompleteEditModel::UpdatePermanentText(
const std::wstring& new_permanent_text) {
// When there's a new URL, and the user is not editing anything or the edit
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index be1a79c..8c2a75b 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -102,10 +102,8 @@ class AutocompleteEditModel : public NotificationObserver {
void SetPopupModel(AutocompletePopupModel* popup_model);
-#ifdef UNIT_TEST
// It should only be used by testing code.
AutocompletePopupModel* popup_model() const { return popup_; }
-#endif
// Invoked when the profile has changed.
void SetProfile(Profile* profile);
@@ -119,6 +117,11 @@ class AutocompleteEditModel : public NotificationObserver {
// Restores local state from the saved |state|.
void RestoreState(const State& state);
+ // Returns the url for the current text. If the user has not edited the text
+ // this is the permanent url, otherwise it is the url the user would navigate
+ // to if they accept the current edit.
+ GURL CurrentURL();
+
// Called when the user wants to export the entire current text as a URL.
// Sets the url, and if known, the title and favicon.
void GetDataForURLExport(GURL* url, std::wstring* title, SkBitmap* favicon);
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
index 2a6b2f5..24d0321 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
@@ -124,6 +124,7 @@ class AutocompleteEditViewWin
virtual bool OnAfterPossibleChange();
virtual gfx::NativeView GetNativeView() const;
virtual CommandUpdater* GetCommandUpdater();
+ int GetPopupMaxYCoordinate();
// Exposes custom IAccessible implementation to the overall MSAA hierarchy.
IAccessible* GetIAccessible();
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.h b/chrome/browser/autocomplete/autocomplete_popup_model.h
index e66903a..818ff2b 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_model.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_model.h
@@ -40,6 +40,8 @@ class AutocompletePopupModel : public NotificationObserver {
// Returns true if the popup is currently open.
bool IsOpen() const;
+ AutocompletePopupView* view() const { return view_; }
+
// Returns the AutocompleteController used by this popup.
AutocompleteController* autocomplete_controller() const {
return controller_.get();
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view.h b/chrome/browser/autocomplete/autocomplete_popup_view.h
index 3fefdba..5eb8c82 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_view.h
@@ -41,6 +41,9 @@ class AutocompletePopupView {
// Returns the popup's model.
virtual AutocompletePopupModel* GetModel() = 0;
+
+ // Returns the max y coordinate of the popup in screen coordinates.
+ virtual int GetMaxYCoordinate() = 0;
};
#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
index b451455..0d5a526 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
@@ -366,6 +366,12 @@ AutocompletePopupModel* AutocompletePopupViewGtk::GetModel() {
return model_.get();
}
+int AutocompletePopupViewGtk::GetMaxYCoordinate() {
+ // TODO: implement if match preview pans out.
+ NOTIMPLEMENTED();
+ return 0;
+}
+
void AutocompletePopupViewGtk::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h
index 61b9f5b..cae3798 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h
@@ -40,6 +40,7 @@ class AutocompletePopupViewGtk : public AutocompletePopupView,
virtual void PaintUpdatesNow();
virtual void OnDragCanceled();
virtual AutocompletePopupModel* GetModel();
+ virtual int GetMaxYCoordinate();
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.h b/chrome/browser/autocomplete/autocomplete_popup_view_mac.h
index 5201c76..5dce4a4 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.h
@@ -72,6 +72,8 @@ class AutocompletePopupViewMac : public AutocompletePopupView {
// Returns the popup's model.
virtual AutocompletePopupModel* GetModel();
+ virtual int GetMaxYCoordinate();
+
// Opens the URL corresponding to the given |row|. If |force_background| is
// true, forces the URL to open in a background tab. Otherwise, determines
// the proper window open disposition from the modifier flags on |[NSApp
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index 14a2560..76e1bd1 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -459,6 +459,12 @@ AutocompletePopupModel* AutocompletePopupViewMac::GetModel() {
return model_.get();
}
+int AutocompletePopupViewMac::GetMaxYCoordinate() {
+ // TODO: implement if match preview pans out.
+ NOTIMPLEMENTED();
+ return 0;
+}
+
void AutocompletePopupViewMac::OpenURLForRow(int row, bool force_background) {
DCHECK_GE(row, 0);