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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "chrome/browser/ssl/security_level_policy.h" |
13 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 14 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 | 16 |
16 class Profile; | 17 class Profile; |
17 class ToolbarModelDelegate; | 18 class ToolbarModelDelegate; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 class NavigationController; | 21 class NavigationController; |
21 class WebContents; | 22 class WebContents; |
22 } | 23 } |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 class X509Certificate; | 26 class X509Certificate; |
26 } | 27 } |
27 | 28 |
28 // This class is the model used by the toolbar, location bar and autocomplete | 29 // This class is the model used by the toolbar, location bar and autocomplete |
29 // edit. It populates its states from the current navigation entry retrieved | 30 // edit. It populates its states from the current navigation entry retrieved |
30 // from the navigation controller returned by GetNavigationController(). | 31 // from the navigation controller returned by GetNavigationController(). |
31 class ToolbarModelImpl : public ToolbarModel { | 32 class ToolbarModelImpl : public ToolbarModel { |
32 public: | 33 public: |
33 explicit ToolbarModelImpl(ToolbarModelDelegate* delegate); | 34 explicit ToolbarModelImpl(ToolbarModelDelegate* delegate); |
34 ~ToolbarModelImpl() override; | 35 ~ToolbarModelImpl() override; |
35 | 36 |
36 static SecurityLevel GetSecurityLevelForWebContents( | 37 static SecurityLevelPolicy::SecurityLevel GetSecurityLevelForWebContents( |
37 content::WebContents* web_contents); | 38 content::WebContents* web_contents); |
38 | 39 |
39 private: | 40 private: |
40 // ToolbarModel: | 41 // ToolbarModel: |
41 base::string16 GetText() const override; | 42 base::string16 GetText() const override; |
42 base::string16 GetFormattedURL(size_t* prefix_end) const override; | 43 base::string16 GetFormattedURL(size_t* prefix_end) const override; |
43 base::string16 GetCorpusNameForMobile() const override; | 44 base::string16 GetCorpusNameForMobile() const override; |
44 GURL GetURL() const override; | 45 GURL GetURL() const override; |
45 bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; | 46 bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; |
46 SecurityLevel GetSecurityLevel(bool ignore_editing) const override; | 47 SecurityLevelPolicy::SecurityLevel GetSecurityLevel( |
| 48 bool ignore_editing) const override; |
47 int GetIcon() const override; | 49 int GetIcon() const override; |
48 int GetIconForSecurityLevel(SecurityLevel level) const override; | 50 int GetIconForSecurityLevel( |
| 51 SecurityLevelPolicy::SecurityLevel level) const override; |
49 base::string16 GetEVCertName() const override; | 52 base::string16 GetEVCertName() const override; |
50 bool ShouldDisplayURL() const override; | 53 bool ShouldDisplayURL() const override; |
51 | 54 |
52 // Returns the navigation controller used to retrieve the navigation entry | 55 // Returns the navigation controller used to retrieve the navigation entry |
53 // from which the states are retrieved. | 56 // from which the states are retrieved. |
54 // If this returns NULL, default values are used. | 57 // If this returns NULL, default values are used. |
55 content::NavigationController* GetNavigationController() const; | 58 content::NavigationController* GetNavigationController() const; |
56 | 59 |
57 // Helper method to extract the profile from the navigation controller. | 60 // Helper method to extract the profile from the navigation controller. |
58 Profile* GetProfile() const; | 61 Profile* GetProfile() const; |
59 | 62 |
60 // Returns search terms as in chrome::GetSearchTerms() if such terms should | 63 // Returns search terms as in chrome::GetSearchTerms() if such terms should |
61 // appear in the omnibox (i.e. the page is sufficiently secure, search term | 64 // appear in the omnibox (i.e. the page is sufficiently secure, search term |
62 // replacement is enabled, editing is not in progress, etc.). If | 65 // replacement is enabled, editing is not in progress, etc.). If |
63 // |ignore_editing| is true, the "editing not in progress" check is skipped. | 66 // |ignore_editing| is true, the "editing not in progress" check is skipped. |
64 base::string16 GetSearchTerms(bool ignore_editing) const; | 67 base::string16 GetSearchTerms(bool ignore_editing) const; |
65 | 68 |
66 ToolbarModelDelegate* delegate_; | 69 ToolbarModelDelegate* delegate_; |
67 | 70 |
68 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl); | 71 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl); |
69 }; | 72 }; |
70 | 73 |
71 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 74 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ |
OLD | NEW |