Chromium Code Reviews| 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 #include "base/string16.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class NavigationController; | 17 class NavigationController; |
| 18 class WebContents; | |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 class X509Certificate; | 22 class X509Certificate; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // This class is the model used by the toolbar, location bar and autocomplete | 25 // This class is the model used by the toolbar, location bar and autocomplete |
| 25 // edit. It populates its states from the current navigation entry retrieved | 26 // edit. It populates its states from the current navigation entry retrieved |
| 26 // from the navigation controller returned by GetNavigationController(). | 27 // from the navigation controller returned by GetNavigationController(). |
| 27 class ToolbarModel { | 28 class ToolbarModel { |
| 28 public: | 29 public: |
| 29 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We | 30 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We |
| 30 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED | 31 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED |
| 31 // needs to be refined into three levels: warning, standard, and EV. | 32 // needs to be refined into three levels: warning, standard, and EV. |
| 32 enum SecurityLevel { | 33 enum SecurityLevel { |
| 33 NONE = 0, // HTTP/no URL/user is editing | 34 NONE = 0, // HTTP/no URL/user is editing |
| 34 EV_SECURE, // HTTPS with valid EV cert | 35 EV_SECURE, // HTTPS with valid EV cert |
| 35 SECURE, // HTTPS (non-EV) | 36 SECURE, // HTTPS (non-EV) |
| 36 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation | 37 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation |
| 37 // status or with insecure content on the page | 38 // status or with insecure content on the page |
| 38 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated | 39 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated |
| 39 NUM_SECURITY_LEVELS, | 40 NUM_SECURITY_LEVELS, |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 explicit ToolbarModel(Browser* browser); | 43 explicit ToolbarModel(Browser* browser); |
|
sky
2012/02/28 18:24:24
I don't like having these two modes, it's too erro
altimofeev
2012/02/29 18:57:29
Done. See TabContentsWrapperContainer interface.
| |
| 44 explicit ToolbarModel(content::WebContents* web_contents); | |
| 43 ~ToolbarModel(); | 45 ~ToolbarModel(); |
| 44 | 46 |
| 45 // Returns the text that should be displayed in the location bar. | 47 // Returns the text that should be displayed in the location bar. |
| 46 string16 GetText() const; | 48 string16 GetText() const; |
| 47 | 49 |
| 48 // Returns the security level that the toolbar should display. | 50 // Returns the security level that the toolbar should display. |
| 49 SecurityLevel GetSecurityLevel() const; | 51 SecurityLevel GetSecurityLevel() const; |
| 50 | 52 |
| 51 // Returns the resource_id of the icon to show to the left of the address, | 53 // Returns the resource_id of the icon to show to the left of the address, |
| 52 // based on the current URL. This doesn't cover specialized icons while the | 54 // based on the current URL. This doesn't cover specialized icons while the |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 68 | 70 |
| 69 // Returns "<organization_name> [<country>]". | 71 // Returns "<organization_name> [<country>]". |
| 70 static string16 GetEVCertName(const net::X509Certificate& cert); | 72 static string16 GetEVCertName(const net::X509Certificate& cert); |
| 71 | 73 |
| 72 private: | 74 private: |
| 73 // Returns the navigation controller used to retrieve the navigation entry | 75 // Returns the navigation controller used to retrieve the navigation entry |
| 74 // from which the states are retrieved. | 76 // from which the states are retrieved. |
| 75 // If this returns NULL, default values are used. | 77 // If this returns NULL, default values are used. |
| 76 content::NavigationController* GetNavigationController() const; | 78 content::NavigationController* GetNavigationController() const; |
| 77 | 79 |
| 80 content::WebContents* GetSelectedWebContents() const; | |
| 81 | |
| 78 Browser* browser_; | 82 Browser* browser_; |
| 83 content::WebContents* web_contents_; | |
| 79 | 84 |
| 80 // Whether the text in the location bar is currently being edited. | 85 // Whether the text in the location bar is currently being edited. |
| 81 bool input_in_progress_; | 86 bool input_in_progress_; |
| 82 | 87 |
| 83 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); | 88 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); |
| 84 }; | 89 }; |
| 85 | 90 |
| 86 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 91 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| OLD | NEW |