Index: chrome/browser/ui/omnibox/omnibox_view.h |
diff --git a/chrome/browser/ui/omnibox/omnibox_view.h b/chrome/browser/ui/omnibox/omnibox_view.h |
index 2c315003ce22623da78c56b7972a81e24c1ec325..b8cc634d4a8e4a97aa78a97447fa4775fcb3ebfc 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_view.h |
+++ b/chrome/browser/ui/omnibox/omnibox_view.h |
@@ -17,13 +17,18 @@ |
#include "base/string_util.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/autocomplete/autocomplete_match.h" |
+#include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
+#include "chrome/browser/ui/toolbar/toolbar_model.h" |
#include "content/public/common/url_constants.h" |
#include "ui/gfx/native_widget_types.h" |
#include "webkit/glue/window_open_disposition.h" |
class CommandUpdater; |
class GURL; |
+class OmniboxEditController; |
class OmniboxEditModel; |
+class Profile; |
+class ToolbarModel; |
namespace content { |
class WebContents; |
@@ -44,8 +49,8 @@ class View; |
class OmniboxView { |
public: |
// Used by the automation system for getting at the model from the view. |
- virtual OmniboxEditModel* model() = 0; |
- virtual const OmniboxEditModel* model() const = 0; |
+ virtual OmniboxEditModel* GetModel(); |
+ virtual const OmniboxEditModel* GetModel() const; |
// For use when switching tabs, this saves the current state onto the tab so |
// that it can be restored during a later call to Update(). |
@@ -68,7 +73,7 @@ class OmniboxView { |
virtual void OpenMatch(const AutocompleteMatch& match, |
WindowOpenDisposition disposition, |
const GURL& alternate_nav_url, |
- size_t selected_line) = 0; |
+ size_t selected_line); |
// Returns the current text of the edit control, which could be the |
// "temporary" text set by the popup, the "permanent" text set by the |
@@ -77,18 +82,18 @@ class OmniboxView { |
// |true| if the user is in the process of editing the field, or if |
// the field is empty. |
- virtual bool IsEditingOrEmpty() const = 0; |
+ virtual bool IsEditingOrEmpty() const; |
// Returns the resource ID of the icon to show for the current text. |
- virtual int GetIcon() const = 0; |
+ virtual int GetIcon() const; |
// The user text is the text the user has manually keyed in. When present, |
// this is shown in preference to the permanent text; hitting escape will |
// revert to the permanent text. |
- virtual void SetUserText(const string16& text) = 0; |
+ void SetUserText(const string16& text); |
virtual void SetUserText(const string16& text, |
const string16& display_text, |
- bool update_popup) = 0; |
+ bool update_popup); |
// Sets the window text and the caret position. |
virtual void SetWindowTextAndCaretPos(const string16& text, |
@@ -123,14 +128,14 @@ class OmniboxView { |
// Reverts the edit and popup back to their unedited state (permanent text |
// showing, popup closed, no user input in progress). |
- virtual void RevertAll() = 0; |
+ virtual void RevertAll(); |
// Updates the autocomplete popup and other state after the text has been |
// changed by the user. |
virtual void UpdatePopup() = 0; |
// Closes the autocomplete popup, if it's open. |
- virtual void ClosePopup() = 0; |
+ virtual void ClosePopup(); |
// Sets the focus to the autocomplete view. |
virtual void SetFocus() = 0; |
@@ -170,9 +175,6 @@ class OmniboxView { |
// the top-most window is the relative window. |
virtual gfx::NativeView GetRelativeWindowForPopup() const = 0; |
- // Returns the command updater for this view. |
- virtual CommandUpdater* GetCommandUpdater() = 0; |
- |
// Shows the instant suggestion text. If |animate_to_complete| is true the |
// view should start an animation that when done commits the text. |
virtual void SetInstantSuggestion(const string16& input, |
@@ -206,6 +208,9 @@ class OmniboxView { |
virtual int WidthOfTextAfterCursor() = 0; |
#endif |
+ virtual CommandUpdater* GetCommandUpdater(); |
+ virtual const CommandUpdater* GetCommandUpdater() const; |
+ |
// Returns a string with any leading javascript schemas stripped from the |
// input text. |
static string16 StripJavascriptSchemas(const string16& text); |
@@ -215,7 +220,30 @@ class OmniboxView { |
// from bookmarks on the clipboard. |
static string16 GetClipboardText(); |
- virtual ~OmniboxView() {} |
+ virtual ~OmniboxView(); |
Peter Kasting
2012/07/26 03:59:17
Nit: Destructor should be at the top of the releva
dominich
2012/07/26 22:33:24
It can't be protected. It's destroyed through scop
Peter Kasting
2012/07/26 23:03:24
Ah, I see. Yeah, has to be public.
|
+ |
+ protected: |
+ OmniboxView(Profile* profile, |
+ OmniboxEditController* controller, |
+ ToolbarModel* toolbar_model, |
+ CommandUpdater* command_updater); |
+ |
+ // Internally invoked whenever the text changes in some way. |
+ virtual void TextChanged(); |
+ |
+ // Return the number of characters in the current buffer. |
+ virtual int GetOmniboxTextLength() const = 0; |
+ |
+ // Try to parse the current text as a URL and colorize the components. |
+ virtual void EmphasizeURLComponents() = 0; |
+ |
+ scoped_ptr<OmniboxEditModel> model_; |
Peter Kasting
2012/07/26 03:59:17
Nit: The Google style guide forbids protected data
dominich
2012/07/26 22:33:24
Done.
|
+ OmniboxEditController* controller_; |
+ ToolbarModel* toolbar_model_; |
+ |
+ // The object that handles additional command functionality exposed on the |
+ // edit, such as invoking the keyword editor. |
+ CommandUpdater* command_updater_; |
}; |
#endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ |