OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/string16.h" |
12 | 13 |
13 class Browser; | 14 class Browser; |
14 class NavigationController; | 15 class NavigationController; |
15 | 16 |
| 17 namespace net { |
| 18 class X509Certificate; |
| 19 } |
| 20 |
16 // 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 |
17 // edit. It populates its states from the current navigation entry retrieved | 22 // edit. It populates its states from the current navigation entry retrieved |
18 // from the navigation controller returned by GetNavigationController(). | 23 // from the navigation controller returned by GetNavigationController(). |
19 class ToolbarModel { | 24 class ToolbarModel { |
20 public: | 25 public: |
21 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We | 26 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We |
22 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED | 27 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED |
23 // needs to be refined into three levels: warning, standard, and EV. | 28 // needs to be refined into three levels: warning, standard, and EV. |
24 enum SecurityLevel { | 29 enum SecurityLevel { |
25 NONE = 0, // HTTP/no URL/user is editing | 30 NONE = 0, // HTTP/no URL/user is editing |
(...skipping 21 matching lines...) Expand all Loading... |
47 | 52 |
48 // Returns the name of the EV cert holder. Only call this when the security | 53 // Returns the name of the EV cert holder. Only call this when the security |
49 // level is EV_SECURE. | 54 // level is EV_SECURE. |
50 std::wstring GetEVCertName() const; | 55 std::wstring GetEVCertName() const; |
51 | 56 |
52 // Getter/setter of whether the text in location bar is currently being | 57 // Getter/setter of whether the text in location bar is currently being |
53 // edited. | 58 // edited. |
54 void set_input_in_progress(bool value) { input_in_progress_ = value; } | 59 void set_input_in_progress(bool value) { input_in_progress_ = value; } |
55 bool input_in_progress() const { return input_in_progress_; } | 60 bool input_in_progress() const { return input_in_progress_; } |
56 | 61 |
| 62 // Returns "<organization_name> [<country>]". |
| 63 static string16 GetEVCertName(const net::X509Certificate& cert); |
| 64 |
57 private: | 65 private: |
58 // Returns the navigation controller used to retrieve the navigation entry | 66 // Returns the navigation controller used to retrieve the navigation entry |
59 // from which the states are retrieved. | 67 // from which the states are retrieved. |
60 // If this returns NULL, default values are used. | 68 // If this returns NULL, default values are used. |
61 NavigationController* GetNavigationController() const; | 69 NavigationController* GetNavigationController() const; |
62 | 70 |
63 Browser* browser_; | 71 Browser* browser_; |
64 | 72 |
65 // Whether the text in the location bar is currently being edited. | 73 // Whether the text in the location bar is currently being edited. |
66 bool input_in_progress_; | 74 bool input_in_progress_; |
67 | 75 |
68 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); | 76 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); |
69 }; | 77 }; |
70 | 78 |
71 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 79 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
OLD | NEW |