OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void Init(); | 59 void Init(); |
60 | 60 |
61 // Exposes the RenderText for tests. | 61 // Exposes the RenderText for tests. |
62 #if defined(UNIT_TEST) | 62 #if defined(UNIT_TEST) |
63 gfx::RenderText* GetRenderText() { | 63 gfx::RenderText* GetRenderText() { |
64 return views::Textfield::GetRenderText(); | 64 return views::Textfield::GetRenderText(); |
65 } | 65 } |
66 #endif | 66 #endif |
67 | 67 |
68 // OmniboxView: | 68 // OmniboxView: |
69 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; | 69 virtual void SaveStateToTab(content::WebContents* tab) override; |
70 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; | 70 virtual void OnTabChanged(const content::WebContents* web_contents) override; |
71 virtual void Update() OVERRIDE; | 71 virtual void Update() override; |
72 virtual void UpdatePlaceholderText() OVERRIDE; | 72 virtual void UpdatePlaceholderText() override; |
73 virtual base::string16 GetText() const OVERRIDE; | 73 virtual base::string16 GetText() const override; |
74 virtual void SetUserText(const base::string16& text, | 74 virtual void SetUserText(const base::string16& text, |
75 const base::string16& display_text, | 75 const base::string16& display_text, |
76 bool update_popup) OVERRIDE; | 76 bool update_popup) override; |
77 virtual void SetForcedQuery() OVERRIDE; | 77 virtual void SetForcedQuery() override; |
78 virtual void GetSelectionBounds( | 78 virtual void GetSelectionBounds( |
79 base::string16::size_type* start, | 79 base::string16::size_type* start, |
80 base::string16::size_type* end) const OVERRIDE; | 80 base::string16::size_type* end) const override; |
81 virtual void SelectAll(bool reversed) OVERRIDE; | 81 virtual void SelectAll(bool reversed) override; |
82 virtual void RevertAll() OVERRIDE; | 82 virtual void RevertAll() override; |
83 virtual void SetFocus() OVERRIDE; | 83 virtual void SetFocus() override; |
84 virtual int GetTextWidth() const OVERRIDE; | 84 virtual int GetTextWidth() const override; |
85 virtual bool IsImeComposing() const OVERRIDE; | 85 virtual bool IsImeComposing() const override; |
86 | 86 |
87 // views::Textfield: | 87 // views::Textfield: |
88 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 88 virtual gfx::Size GetMinimumSize() const override; |
89 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 89 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
90 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 90 virtual void ExecuteCommand(int command_id, int event_flags) override; |
91 | 91 |
92 private: | 92 private: |
93 FRIEND_TEST_ALL_PREFIXES(OmniboxViewViewsTest, CloseOmniboxPopupOnTextDrag); | 93 FRIEND_TEST_ALL_PREFIXES(OmniboxViewViewsTest, CloseOmniboxPopupOnTextDrag); |
94 | 94 |
95 // Update the field with |text| and set the selection. | 95 // Update the field with |text| and set the selection. |
96 void SetTextAndSelectedRange(const base::string16& text, | 96 void SetTextAndSelectedRange(const base::string16& text, |
97 const gfx::Range& range); | 97 const gfx::Range& range); |
98 | 98 |
99 // Returns the selected text. | 99 // Returns the selected text. |
100 base::string16 GetSelectedText() const; | 100 base::string16 GetSelectedText() const; |
(...skipping 11 matching lines...) Expand all Loading... |
112 | 112 |
113 // Handles a request to change the value of this text field from software | 113 // Handles a request to change the value of this text field from software |
114 // using an accessibility API (typically automation software, screen readers | 114 // using an accessibility API (typically automation software, screen readers |
115 // don't normally use this). Sets the value and clears the selection. | 115 // don't normally use this). Sets the value and clears the selection. |
116 void AccessibilitySetValue(const base::string16& new_value); | 116 void AccessibilitySetValue(const base::string16& new_value); |
117 | 117 |
118 // OmniboxView: | 118 // OmniboxView: |
119 virtual void SetWindowTextAndCaretPos(const base::string16& text, | 119 virtual void SetWindowTextAndCaretPos(const base::string16& text, |
120 size_t caret_pos, | 120 size_t caret_pos, |
121 bool update_popup, | 121 bool update_popup, |
122 bool notify_text_changed) OVERRIDE; | 122 bool notify_text_changed) override; |
123 virtual bool IsSelectAll() const OVERRIDE; | 123 virtual bool IsSelectAll() const override; |
124 virtual bool DeleteAtEndPressed() OVERRIDE; | 124 virtual bool DeleteAtEndPressed() override; |
125 virtual void UpdatePopup() OVERRIDE; | 125 virtual void UpdatePopup() override; |
126 virtual void ApplyCaretVisibility() OVERRIDE; | 126 virtual void ApplyCaretVisibility() override; |
127 virtual void OnTemporaryTextMaybeChanged( | 127 virtual void OnTemporaryTextMaybeChanged( |
128 const base::string16& display_text, | 128 const base::string16& display_text, |
129 bool save_original_selection, | 129 bool save_original_selection, |
130 bool notify_text_changed) OVERRIDE; | 130 bool notify_text_changed) override; |
131 virtual bool OnInlineAutocompleteTextMaybeChanged( | 131 virtual bool OnInlineAutocompleteTextMaybeChanged( |
132 const base::string16& display_text, size_t user_text_length) OVERRIDE; | 132 const base::string16& display_text, size_t user_text_length) override; |
133 virtual void OnInlineAutocompleteTextCleared() OVERRIDE; | 133 virtual void OnInlineAutocompleteTextCleared() override; |
134 virtual void OnRevertTemporaryText() OVERRIDE; | 134 virtual void OnRevertTemporaryText() override; |
135 virtual void OnBeforePossibleChange() OVERRIDE; | 135 virtual void OnBeforePossibleChange() override; |
136 virtual bool OnAfterPossibleChange() OVERRIDE; | 136 virtual bool OnAfterPossibleChange() override; |
137 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 137 virtual gfx::NativeView GetNativeView() const override; |
138 virtual gfx::NativeView GetRelativeWindowForPopup() const OVERRIDE; | 138 virtual gfx::NativeView GetRelativeWindowForPopup() const override; |
139 virtual void SetGrayTextAutocompletion(const base::string16& input) OVERRIDE; | 139 virtual void SetGrayTextAutocompletion(const base::string16& input) override; |
140 virtual base::string16 GetGrayTextAutocompletion() const OVERRIDE; | 140 virtual base::string16 GetGrayTextAutocompletion() const override; |
141 virtual int GetWidth() const OVERRIDE; | 141 virtual int GetWidth() const override; |
142 virtual bool IsImeShowingPopup() const OVERRIDE; | 142 virtual bool IsImeShowingPopup() const override; |
143 virtual void ShowImeIfNeeded() OVERRIDE; | 143 virtual void ShowImeIfNeeded() override; |
144 virtual void OnMatchOpened(const AutocompleteMatch& match, | 144 virtual void OnMatchOpened(const AutocompleteMatch& match, |
145 content::WebContents* web_contents) OVERRIDE; | 145 content::WebContents* web_contents) override; |
146 virtual int GetOmniboxTextLength() const OVERRIDE; | 146 virtual int GetOmniboxTextLength() const override; |
147 virtual void EmphasizeURLComponents() OVERRIDE; | 147 virtual void EmphasizeURLComponents() override; |
148 | 148 |
149 // views::Textfield: | 149 // views::Textfield: |
150 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | 150 virtual bool OnKeyReleased(const ui::KeyEvent& event) override; |
151 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 151 virtual bool IsItemForCommandIdDynamic(int command_id) const override; |
152 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 152 virtual base::string16 GetLabelForCommandId(int command_id) const override; |
153 virtual const char* GetClassName() const OVERRIDE; | 153 virtual const char* GetClassName() const override; |
154 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 154 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
155 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 155 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; |
156 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 156 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
157 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 157 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
158 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 158 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
159 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 159 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
160 virtual bool SkipDefaultKeyEventProcessing( | 160 virtual bool SkipDefaultKeyEventProcessing( |
161 const ui::KeyEvent& event) OVERRIDE; | 161 const ui::KeyEvent& event) override; |
162 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 162 virtual void GetAccessibleState(ui::AXViewState* state) override; |
163 virtual void OnFocus() OVERRIDE; | 163 virtual void OnFocus() override; |
164 virtual void OnBlur() OVERRIDE; | 164 virtual void OnBlur() override; |
165 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 165 virtual bool IsCommandIdEnabled(int command_id) const override; |
166 virtual base::string16 GetSelectionClipboardText() const OVERRIDE; | 166 virtual base::string16 GetSelectionClipboardText() const override; |
167 | 167 |
168 // chromeos::input_method::InputMethodManager::CandidateWindowObserver: | 168 // chromeos::input_method::InputMethodManager::CandidateWindowObserver: |
169 #if defined(OS_CHROMEOS) | 169 #if defined(OS_CHROMEOS) |
170 virtual void CandidateWindowOpened( | 170 virtual void CandidateWindowOpened( |
171 chromeos::input_method::InputMethodManager* manager) OVERRIDE; | 171 chromeos::input_method::InputMethodManager* manager) override; |
172 virtual void CandidateWindowClosed( | 172 virtual void CandidateWindowClosed( |
173 chromeos::input_method::InputMethodManager* manager) OVERRIDE; | 173 chromeos::input_method::InputMethodManager* manager) override; |
174 #endif | 174 #endif |
175 | 175 |
176 // views::TextfieldController: | 176 // views::TextfieldController: |
177 virtual void ContentsChanged(views::Textfield* sender, | 177 virtual void ContentsChanged(views::Textfield* sender, |
178 const base::string16& new_contents) OVERRIDE; | 178 const base::string16& new_contents) override; |
179 virtual bool HandleKeyEvent(views::Textfield* sender, | 179 virtual bool HandleKeyEvent(views::Textfield* sender, |
180 const ui::KeyEvent& key_event) OVERRIDE; | 180 const ui::KeyEvent& key_event) override; |
181 virtual void OnBeforeUserAction(views::Textfield* sender) OVERRIDE; | 181 virtual void OnBeforeUserAction(views::Textfield* sender) override; |
182 virtual void OnAfterUserAction(views::Textfield* sender) OVERRIDE; | 182 virtual void OnAfterUserAction(views::Textfield* sender) override; |
183 virtual void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) OVERRIDE; | 183 virtual void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) override; |
184 virtual void OnWriteDragData(ui::OSExchangeData* data) OVERRIDE; | 184 virtual void OnWriteDragData(ui::OSExchangeData* data) override; |
185 virtual void OnGetDragOperationsForTextfield(int* drag_operations) OVERRIDE; | 185 virtual void OnGetDragOperationsForTextfield(int* drag_operations) override; |
186 virtual void AppendDropFormats( | 186 virtual void AppendDropFormats( |
187 int* formats, | 187 int* formats, |
188 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 188 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override; |
189 virtual int OnDrop(const ui::OSExchangeData& data) OVERRIDE; | 189 virtual int OnDrop(const ui::OSExchangeData& data) override; |
190 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) OVERRIDE; | 190 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) override; |
191 | 191 |
192 // When true, the location bar view is read only and also is has a slightly | 192 // When true, the location bar view is read only and also is has a slightly |
193 // different presentation (smaller font size). This is used for popups. | 193 // different presentation (smaller font size). This is used for popups. |
194 bool popup_window_mode_; | 194 bool popup_window_mode_; |
195 | 195 |
196 scoped_ptr<OmniboxPopupView> popup_view_; | 196 scoped_ptr<OmniboxPopupView> popup_view_; |
197 | 197 |
198 ToolbarModel::SecurityLevel security_level_; | 198 ToolbarModel::SecurityLevel security_level_; |
199 | 199 |
200 // Selection persisted across temporary text changes, like popup suggestions. | 200 // Selection persisted across temporary text changes, like popup suggestions. |
(...skipping 28 matching lines...) Expand all Loading... |
229 // and gets a tap. So we use this variable to remember focus state before tap. | 229 // and gets a tap. So we use this variable to remember focus state before tap. |
230 bool select_all_on_gesture_tap_; | 230 bool select_all_on_gesture_tap_; |
231 | 231 |
232 // Used to bind callback functions to this object. | 232 // Used to bind callback functions to this object. |
233 base::WeakPtrFactory<OmniboxViewViews> weak_ptr_factory_; | 233 base::WeakPtrFactory<OmniboxViewViews> weak_ptr_factory_; |
234 | 234 |
235 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 235 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
236 }; | 236 }; |
237 | 237 |
238 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 238 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
OLD | NEW |