| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ | 5 #ifndef COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ |
| 6 #define COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ | 6 #define COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "components/security_state/core/security_state.h" | 14 #include "components/security_state/core/security_state.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 enum class VectorIconId; | 18 struct VectorIcon; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // This class is the model used by the toolbar, location bar and autocomplete | 21 // This class is the model used by the toolbar, location bar and autocomplete |
| 22 // edit. It populates its states from the current navigation entry retrieved | 22 // edit. It populates its states from the current navigation entry retrieved |
| 23 // from the navigation controller returned by GetNavigationController(). | 23 // from the navigation controller returned by GetNavigationController(). |
| 24 class ToolbarModel { | 24 class ToolbarModel { |
| 25 public: | 25 public: |
| 26 virtual ~ToolbarModel() = default; | 26 virtual ~ToolbarModel() = default; |
| 27 | 27 |
| 28 // Returns a formatted URL for display in the toolbar. The formatting | 28 // Returns a formatted URL for display in the toolbar. The formatting |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 // |ignore_editing| is true, the result reflects the underlying state of the | 40 // |ignore_editing| is true, the result reflects the underlying state of the |
| 41 // page without regard to any user edits that may be in progress in the | 41 // page without regard to any user edits that may be in progress in the |
| 42 // omnibox. | 42 // omnibox. |
| 43 virtual security_state::SecurityLevel GetSecurityLevel( | 43 virtual security_state::SecurityLevel GetSecurityLevel( |
| 44 bool ignore_editing) const = 0; | 44 bool ignore_editing) const = 0; |
| 45 | 45 |
| 46 // Returns the id of the icon to show to the left of the address, based on the | 46 // Returns the id of the icon to show to the left of the address, based on the |
| 47 // current URL. When search term replacement is active, this returns a search | 47 // current URL. When search term replacement is active, this returns a search |
| 48 // icon. This doesn't cover specialized icons while the user is editing; see | 48 // icon. This doesn't cover specialized icons while the user is editing; see |
| 49 // OmniboxView::GetVectorIcon(). | 49 // OmniboxView::GetVectorIcon(). |
| 50 virtual gfx::VectorIconId GetVectorIcon() const = 0; | 50 virtual const gfx::VectorIcon& GetVectorIcon() const = 0; |
| 51 | 51 |
| 52 // Returns text for the omnibox secure verbose chip. | 52 // Returns text for the omnibox secure verbose chip. |
| 53 virtual base::string16 GetSecureVerboseText() const = 0; | 53 virtual base::string16 GetSecureVerboseText() const = 0; |
| 54 | 54 |
| 55 // Returns the name of the EV cert holder. This returns an empty string if | 55 // Returns the name of the EV cert holder. This returns an empty string if |
| 56 // the security level is not EV_SECURE. | 56 // the security level is not EV_SECURE. |
| 57 virtual base::string16 GetEVCertName() const = 0; | 57 virtual base::string16 GetEVCertName() const = 0; |
| 58 | 58 |
| 59 // Returns whether the URL for the current navigation entry should be | 59 // Returns whether the URL for the current navigation entry should be |
| 60 // in the location bar. | 60 // in the location bar. |
| 61 virtual bool ShouldDisplayURL() const = 0; | 61 virtual bool ShouldDisplayURL() const = 0; |
| 62 | 62 |
| 63 // Whether the text in the omnibox is currently being edited. | 63 // Whether the text in the omnibox is currently being edited. |
| 64 void set_input_in_progress(bool input_in_progress) { | 64 void set_input_in_progress(bool input_in_progress) { |
| 65 input_in_progress_ = input_in_progress; | 65 input_in_progress_ = input_in_progress; |
| 66 } | 66 } |
| 67 bool input_in_progress() const { return input_in_progress_; } | 67 bool input_in_progress() const { return input_in_progress_; } |
| 68 | 68 |
| 69 protected: | 69 protected: |
| 70 ToolbarModel() : input_in_progress_(false) {} | 70 ToolbarModel() : input_in_progress_(false) {} |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 bool input_in_progress_; | 73 bool input_in_progress_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); | 75 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif // COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ | 78 #endif // COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ |
| OLD | NEW |