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 // This file defines the interface class OmniboxView. Each toolkit will | 5 // This file defines the interface class OmniboxView. Each toolkit will |
6 // implement the edit view differently, so that code is inherently platform | 6 // implement the edit view differently, so that code is inherently platform |
7 // specific. However, the OmniboxEditModel needs to do some communication with | 7 // specific. However, the OmniboxEditModel needs to do some communication with |
8 // the view. Since the model is shared between platforms, we need to define an | 8 // the view. Since the model is shared between platforms, we need to define an |
9 // interface that all view implementations will share. | 9 // interface that all view implementations will share. |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 // etc. So all newlines are removed. | 241 // etc. So all newlines are removed. |
242 // * Otherwise, users may be pasting in search data, e.g. street addresses. In | 242 // * Otherwise, users may be pasting in search data, e.g. street addresses. In |
243 // this case, runs of whitespace are collapsed down to single spaces. | 243 // this case, runs of whitespace are collapsed down to single spaces. |
244 static base::string16 SanitizeTextForPaste(const base::string16& text); | 244 static base::string16 SanitizeTextForPaste(const base::string16& text); |
245 | 245 |
246 // Returns the current clipboard contents as a string that can be pasted in. | 246 // Returns the current clipboard contents as a string that can be pasted in. |
247 // In addition to just getting CF_UNICODETEXT out, this can also extract URLs | 247 // In addition to just getting CF_UNICODETEXT out, this can also extract URLs |
248 // from bookmarks on the clipboard. | 248 // from bookmarks on the clipboard. |
249 static base::string16 GetClipboardText(); | 249 static base::string16 GetClipboardText(); |
250 | 250 |
251 // Disables search term replacement, reverts the omnibox, and selects all. | |
252 void ShowURL(); | |
Greg Billock
2013/12/12 19:02:31
Note: this replicates Justin's change. That's in t
| |
253 | |
251 protected: | 254 protected: |
252 OmniboxView(Profile* profile, | 255 OmniboxView(Profile* profile, |
253 OmniboxEditController* controller, | 256 OmniboxEditController* controller, |
254 CommandUpdater* command_updater); | 257 CommandUpdater* command_updater); |
255 | 258 |
256 // Internally invoked whenever the text changes in some way. | 259 // Internally invoked whenever the text changes in some way. |
257 virtual void TextChanged(); | 260 virtual void TextChanged(); |
258 | 261 |
259 // Disables search term replacement, reverts the omnibox, and selects all. | |
260 void ShowURL(); | |
261 | |
262 // Return the number of characters in the current buffer. The name | 262 // Return the number of characters in the current buffer. The name |
263 // |GetTextLength| can't be used as the Windows override of this class | 263 // |GetTextLength| can't be used as the Windows override of this class |
264 // inherits from a class that defines a method with that name. | 264 // inherits from a class that defines a method with that name. |
265 virtual int GetOmniboxTextLength() const = 0; | 265 virtual int GetOmniboxTextLength() const = 0; |
266 | 266 |
267 // Try to parse the current text as a URL and colorize the components. | 267 // Try to parse the current text as a URL and colorize the components. |
268 virtual void EmphasizeURLComponents() = 0; | 268 virtual void EmphasizeURLComponents() = 0; |
269 | 269 |
270 OmniboxEditController* controller() { return controller_; } | 270 OmniboxEditController* controller() { return controller_; } |
271 const OmniboxEditController* controller() const { return controller_; } | 271 const OmniboxEditController* controller() const { return controller_; } |
272 | 272 |
273 private: | 273 private: |
274 friend class OmniboxViewMacTest; | 274 friend class OmniboxViewMacTest; |
275 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | 275 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
276 | 276 |
277 // |model_| can be NULL in tests. | 277 // |model_| can be NULL in tests. |
278 scoped_ptr<OmniboxEditModel> model_; | 278 scoped_ptr<OmniboxEditModel> model_; |
279 OmniboxEditController* controller_; | 279 OmniboxEditController* controller_; |
280 | 280 |
281 // The object that handles additional command functionality exposed on the | 281 // The object that handles additional command functionality exposed on the |
282 // edit, such as invoking the keyword editor. | 282 // edit, such as invoking the keyword editor. |
283 CommandUpdater* command_updater_; | 283 CommandUpdater* command_updater_; |
284 }; | 284 }; |
285 | 285 |
286 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ | 286 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ |
OLD | NEW |