| 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 CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "chrome/browser/ssl/connection_security_helper.h" | 12 #include "chrome/browser/ssl/connection_security_status.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 class X509Certificate; | 16 class X509Certificate; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // This class is the model used by the toolbar, location bar and autocomplete | 19 // This class is the model used by the toolbar, location bar and autocomplete |
| 20 // edit. It populates its states from the current navigation entry retrieved | 20 // edit. It populates its states from the current navigation entry retrieved |
| 21 // from the navigation controller returned by GetNavigationController(). | 21 // from the navigation controller returned by GetNavigationController(). |
| 22 class ToolbarModel { | 22 class ToolbarModel { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 virtual bool WouldPerformSearchTermReplacement(bool ignore_editing) const = 0; | 56 virtual bool WouldPerformSearchTermReplacement(bool ignore_editing) const = 0; |
| 57 | 57 |
| 58 // Returns true if a call to GetText() would return something other than the | 58 // Returns true if a call to GetText() would return something other than the |
| 59 // URL because of search term replacement. | 59 // URL because of search term replacement. |
| 60 bool WouldReplaceURL() const; | 60 bool WouldReplaceURL() const; |
| 61 | 61 |
| 62 // Returns the security level that the toolbar should display. If | 62 // Returns the security level that the toolbar should display. If |
| 63 // |ignore_editing| is true, the result reflects the underlying state of the | 63 // |ignore_editing| is true, the result reflects the underlying state of the |
| 64 // page without regard to any user edits that may be in progress in the | 64 // page without regard to any user edits that may be in progress in the |
| 65 // omnibox. | 65 // omnibox. |
| 66 virtual ConnectionSecurityHelper::SecurityLevel GetSecurityLevel( | 66 virtual ConnectionSecurityStatus::SecurityLevel GetSecurityLevel( |
| 67 bool ignore_editing) const = 0; | 67 bool ignore_editing) const = 0; |
| 68 | 68 |
| 69 // Returns the resource_id of the icon to show to the left of the address, | 69 // Returns the resource_id of the icon to show to the left of the address, |
| 70 // based on the current URL. When search term replacement is active, this | 70 // based on the current URL. When search term replacement is active, this |
| 71 // returns a search icon. This doesn't cover specialized icons while the | 71 // returns a search icon. This doesn't cover specialized icons while the |
| 72 // user is editing; see OmniboxView::GetIcon(). | 72 // user is editing; see OmniboxView::GetIcon(). |
| 73 virtual int GetIcon() const = 0; | 73 virtual int GetIcon() const = 0; |
| 74 | 74 |
| 75 // As |GetIcon()|, but returns the icon only taking into account the security | 75 // As |GetIcon()|, but returns the icon only taking into account the security |
| 76 // |level| given, ignoring search term replacement state. | 76 // |level| given, ignoring search term replacement state. |
| 77 virtual int GetIconForSecurityLevel( | 77 virtual int GetIconForSecurityLevel( |
| 78 ConnectionSecurityHelper::SecurityLevel level) const = 0; | 78 ConnectionSecurityStatus::SecurityLevel level) const = 0; |
| 79 | 79 |
| 80 // Returns the name of the EV cert holder. This returns an empty string if | 80 // Returns the name of the EV cert holder. This returns an empty string if |
| 81 // the security level is not EV_SECURE. | 81 // the security level is not EV_SECURE. |
| 82 virtual base::string16 GetEVCertName() const = 0; | 82 virtual base::string16 GetEVCertName() const = 0; |
| 83 | 83 |
| 84 // Returns whether the URL for the current navigation entry should be | 84 // Returns whether the URL for the current navigation entry should be |
| 85 // in the location bar. | 85 // in the location bar. |
| 86 virtual bool ShouldDisplayURL() const = 0; | 86 virtual bool ShouldDisplayURL() const = 0; |
| 87 | 87 |
| 88 // Whether the text in the omnibox is currently being edited. | 88 // Whether the text in the omnibox is currently being edited. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 103 ToolbarModel(); | 103 ToolbarModel(); |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 bool input_in_progress_; | 106 bool input_in_progress_; |
| 107 bool url_replacement_enabled_; | 107 bool url_replacement_enabled_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); | 109 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 112 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| OLD | NEW |