Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model.h

Issue 1124383007: Revert of Revert of Move SecurityLevel into a class of its own (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace net { 15 namespace net {
15 class X509Certificate; 16 class X509Certificate;
16 } 17 }
17 18
18 // 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
19 // edit. It populates its states from the current navigation entry retrieved 20 // edit. It populates its states from the current navigation entry retrieved
20 // from the navigation controller returned by GetNavigationController(). 21 // from the navigation controller returned by GetNavigationController().
21 class ToolbarModel { 22 class ToolbarModel {
22 public: 23 public:
23 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We
24 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED
25 // needs to be refined into three levels: warning, standard, and EV.
26 //
27 // A Java counterpart will be generated for this enum.
28 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ui.toolbar
29 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: ToolbarModelSecurityLevel
30 enum SecurityLevel {
31 // HTTP/no URL/user is editing
32 NONE = 0,
33
34 // HTTPS with valid EV cert
35 EV_SECURE = 1,
36
37 // HTTPS (non-EV)
38 SECURE = 2,
39
40 // HTTPS, but unable to check certificate revocation status or with insecure
41 // content on the page
42 SECURITY_WARNING = 3,
43
44 // HTTPS, but the certificate verification chain is anchored on a
45 // certificate that was installed by the system administrator
46 SECURITY_POLICY_WARNING = 4,
47
48 // Attempted HTTPS and failed, page not authenticated
49 SECURITY_ERROR = 5,
50
51 NUM_SECURITY_LEVELS = 6,
52 };
53
54 virtual ~ToolbarModel(); 24 virtual ~ToolbarModel();
55 25
56 // Returns the text to be displayed in the toolbar for the current page. 26 // Returns the text to be displayed in the toolbar for the current page.
57 // This will have been formatted for display to the user. 27 // This will have been formatted for display to the user.
58 // - If the current page's URL is a search URL for the user's default search 28 // - If the current page's URL is a search URL for the user's default search
59 // engine, the query will be extracted and returned for display instead 29 // engine, the query will be extracted and returned for display instead
60 // of the URL. 30 // of the URL.
61 // - Otherwise, the text will contain the URL returned by GetFormattedURL(). 31 // - Otherwise, the text will contain the URL returned by GetFormattedURL().
62 virtual base::string16 GetText() const = 0; 32 virtual base::string16 GetText() const = 0;
63 33
(...skipping 22 matching lines...) Expand all
86 virtual bool WouldPerformSearchTermReplacement(bool ignore_editing) const = 0; 56 virtual bool WouldPerformSearchTermReplacement(bool ignore_editing) const = 0;
87 57
88 // 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
89 // URL because of search term replacement. 59 // URL because of search term replacement.
90 bool WouldReplaceURL() const; 60 bool WouldReplaceURL() const;
91 61
92 // Returns the security level that the toolbar should display. If 62 // Returns the security level that the toolbar should display. If
93 // |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
94 // 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
95 // omnibox. 65 // omnibox.
96 virtual SecurityLevel GetSecurityLevel(bool ignore_editing) const = 0; 66 virtual ConnectionSecurityHelper::SecurityLevel GetSecurityLevel(
67 bool ignore_editing) const = 0;
97 68
98 // 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,
99 // 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
100 // 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
101 // user is editing; see OmniboxView::GetIcon(). 72 // user is editing; see OmniboxView::GetIcon().
102 virtual int GetIcon() const = 0; 73 virtual int GetIcon() const = 0;
103 74
104 // 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
105 // |level| given, ignoring search term replacement state. 76 // |level| given, ignoring search term replacement state.
106 virtual int GetIconForSecurityLevel(SecurityLevel level) const = 0; 77 virtual int GetIconForSecurityLevel(
78 ConnectionSecurityHelper::SecurityLevel level) const = 0;
107 79
108 // 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
109 // the security level is not EV_SECURE. 81 // the security level is not EV_SECURE.
110 virtual base::string16 GetEVCertName() const = 0; 82 virtual base::string16 GetEVCertName() const = 0;
111 83
112 // Returns whether the URL for the current navigation entry should be 84 // Returns whether the URL for the current navigation entry should be
113 // in the location bar. 85 // in the location bar.
114 virtual bool ShouldDisplayURL() const = 0; 86 virtual bool ShouldDisplayURL() const = 0;
115 87
116 // 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
131 ToolbarModel(); 103 ToolbarModel();
132 104
133 private: 105 private:
134 bool input_in_progress_; 106 bool input_in_progress_;
135 bool url_replacement_enabled_; 107 bool url_replacement_enabled_;
136 108
137 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); 109 DISALLOW_COPY_AND_ASSIGN(ToolbarModel);
138 }; 110 };
139 111
140 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ 112 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/test_toolbar_model.cc ('k') | chrome/browser/ui/toolbar/toolbar_model_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698