OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHROME_TOOLBAR_MODEL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" | 8 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" |
9 | 9 |
10 class Profile; | 10 class Profile; |
11 | 11 |
12 namespace content { | 12 namespace content { |
| 13 class NavigationEntry; |
13 class NavigationController; | 14 class NavigationController; |
14 } | 15 } |
15 | 16 |
16 // Partial implementation of ToolbarModelDelegate using //chrome API. | 17 // Partial implementation of ToolbarModelDelegate using //chrome API. |
17 class ChromeToolbarModelDelegate : public ToolbarModelDelegate { | 18 class ChromeToolbarModelDelegate : public ToolbarModelDelegate { |
18 public: | 19 public: |
| 20 // Returns active WebContents. |
| 21 virtual content::WebContents* GetActiveWebContents() const = 0; |
| 22 |
| 23 protected: |
| 24 ~ChromeToolbarModelDelegate() override; |
| 25 |
| 26 private: |
19 // ToolbarModelDelegate implementation: | 27 // ToolbarModelDelegate implementation: |
20 std::string GetAcceptLanguages() const override; | 28 std::string GetAcceptLanguages() const override; |
21 base::string16 FormattedStringWithEquivalentMeaning( | 29 base::string16 FormattedStringWithEquivalentMeaning( |
22 const GURL& url, | 30 const GURL& url, |
23 const base::string16& formatted_url) const override; | 31 const base::string16& formatted_url) const override; |
| 32 bool GetURL(GURL* url) const override; |
| 33 bool ShouldDisplayURL() const override; |
| 34 SecurityLevel GetSecurityLevel() const override; |
| 35 base::string16 GetSearchTerms(SecurityLevel security_level) const override; |
| 36 scoped_refptr<net::X509Certificate> GetCertificate() const override; |
24 | 37 |
25 protected: | |
26 ~ChromeToolbarModelDelegate() override; | |
27 | |
28 private: | |
29 // Returns the navigation controller used to retrive the navigation entry | 38 // Returns the navigation controller used to retrive the navigation entry |
30 // from which the states are retrieved. If this returns null, default values | 39 // from which the states are retrieved. If this returns null, default values |
31 // are used. | 40 // are used. |
32 content::NavigationController* GetNavigationController() const; | 41 content::NavigationController* GetNavigationController() const; |
33 | 42 |
| 43 // Helper method to extract the navigation entry from the navigation |
| 44 // controller. |
| 45 content::NavigationEntry* GetNavigationEntry() const; |
| 46 |
34 // Helper method to extract the profile from the navigation controller. | 47 // Helper method to extract the profile from the navigation controller. |
35 Profile* GetProfile() const; | 48 Profile* GetProfile() const; |
36 }; | 49 }; |
37 | 50 |
38 #endif // CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_DELEGATE_H_ | 51 #endif // CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_DELEGATE_H_ |
OLD | NEW |