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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Fills |state| with the current text state. | 242 // Fills |state| with the current text state. |
243 void GetState(State* state); | 243 void GetState(State* state); |
244 | 244 |
245 // Returns the delta between |before| and |after|. | 245 // Returns the delta between |before| and |after|. |
246 StateChanges GetStateChanges(const State& before, | 246 StateChanges GetStateChanges(const State& before, |
247 const State& after); | 247 const State& after); |
248 | 248 |
249 // Internally invoked whenever the text changes in some way. | 249 // Internally invoked whenever the text changes in some way. |
250 virtual void TextChanged(); | 250 virtual void TextChanged(); |
251 | 251 |
252 // Returns whether the current text in the model represents a URL. Provided | |
253 // to allow tests to override the result. | |
254 virtual bool CurrentTextIsURL(); | |
255 | |
256 // Return the number of characters in the current buffer. The name | 252 // Return the number of characters in the current buffer. The name |
257 // |GetTextLength| can't be used as the Windows override of this class | 253 // |GetTextLength| can't be used as the Windows override of this class |
258 // inherits from a class that defines a method with that name. | 254 // inherits from a class that defines a method with that name. |
259 virtual int GetOmniboxTextLength() const = 0; | 255 virtual int GetOmniboxTextLength() const = 0; |
260 | 256 |
261 // Try to parse the current text as a URL and colorize the components. | 257 // Try to parse the current text as a URL and colorize the components. |
262 virtual void EmphasizeURLComponents() = 0; | 258 virtual void EmphasizeURLComponents() = 0; |
263 | 259 |
264 OmniboxEditController* controller() { return controller_; } | 260 OmniboxEditController* controller() { return controller_; } |
265 const OmniboxEditController* controller() const { return controller_; } | 261 const OmniboxEditController* controller() const { return controller_; } |
(...skipping 20 matching lines...) Expand all Loading... |
286 friend class OmniboxViewMacTest; | 282 friend class OmniboxViewMacTest; |
287 | 283 |
288 // |model_| can be NULL in tests. | 284 // |model_| can be NULL in tests. |
289 std::unique_ptr<OmniboxEditModel> model_; | 285 std::unique_ptr<OmniboxEditModel> model_; |
290 OmniboxEditController* controller_; | 286 OmniboxEditController* controller_; |
291 | 287 |
292 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 288 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
293 }; | 289 }; |
294 | 290 |
295 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 291 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
OLD | NEW |