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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 virtual int GetMaxEditWidth(int entry_width) const = 0; | 224 virtual int GetMaxEditWidth(int entry_width) const = 0; |
225 | 225 |
226 // Adds the autocomplete edit view to view hierarchy and | 226 // Adds the autocomplete edit view to view hierarchy and |
227 // returns the views::View of the edit view. | 227 // returns the views::View of the edit view. |
228 virtual views::View* AddToView(views::View* parent) = 0; | 228 virtual views::View* AddToView(views::View* parent) = 0; |
229 | 229 |
230 // Performs the drop of a drag and drop operation on the view. | 230 // Performs the drop of a drag and drop operation on the view. |
231 virtual int OnPerformDrop(const ui::DropTargetEvent& event) = 0; | 231 virtual int OnPerformDrop(const ui::DropTargetEvent& event) = 0; |
232 #endif | 232 #endif |
233 | 233 |
234 // Returns a string with any leading javascript schemas stripped from the | 234 // Returns |text| with any leading javascript schemas stripped. |
235 // input text. | |
236 static string16 StripJavascriptSchemas(const string16& text); | 235 static string16 StripJavascriptSchemas(const string16& text); |
237 | 236 |
| 237 // First, calls StripJavascriptSchemas(). Then automatically collapses |
| 238 // internal whitespace as follows: |
| 239 // * If the only whitespace in |text| is newlines, users are most likely |
| 240 // pasting in URLs split into multiple lines by terminals, email programs, |
| 241 // etc. So all newlines are removed. |
| 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. |
| 244 static string16 SanitizeTextForPaste(const string16& text); |
| 245 |
238 // 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. |
239 // 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 |
240 // from bookmarks on the clipboard. | 248 // from bookmarks on the clipboard. |
241 static string16 GetClipboardText(); | 249 static string16 GetClipboardText(); |
242 | 250 |
243 protected: | 251 protected: |
244 OmniboxView(Profile* profile, | 252 OmniboxView(Profile* profile, |
245 OmniboxEditController* controller, | 253 OmniboxEditController* controller, |
246 ToolbarModel* toolbar_model, | 254 ToolbarModel* toolbar_model, |
247 CommandUpdater* command_updater); | 255 CommandUpdater* command_updater); |
(...skipping 18 matching lines...) Expand all Loading... |
266 scoped_ptr<OmniboxEditModel> model_; | 274 scoped_ptr<OmniboxEditModel> model_; |
267 OmniboxEditController* controller_; | 275 OmniboxEditController* controller_; |
268 ToolbarModel* toolbar_model_; | 276 ToolbarModel* toolbar_model_; |
269 | 277 |
270 // The object that handles additional command functionality exposed on the | 278 // The object that handles additional command functionality exposed on the |
271 // edit, such as invoking the keyword editor. | 279 // edit, such as invoking the keyword editor. |
272 CommandUpdater* command_updater_; | 280 CommandUpdater* command_updater_; |
273 }; | 281 }; |
274 | 282 |
275 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ | 283 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ |
OLD | NEW |