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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" |
10 | 10 |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace content { | 13 namespace content { |
| 14 class NavigationEntry; |
14 class NavigationController; | 15 class NavigationController; |
15 } | 16 } |
16 | 17 |
17 // Implementation of ToolbarModelDelegate for the Chrome embedder. It leaves out | 18 // Implementation of ToolbarModelDelegate for the Chrome embedder. It leaves out |
18 // how to fetch the active WebContents to its subclasses. | 19 // how to fetch the active WebContents to its subclasses. |
19 class ChromeToolbarModelDelegate : public ToolbarModelDelegate { | 20 class ChromeToolbarModelDelegate : public ToolbarModelDelegate { |
20 public: | 21 public: |
21 // ToolbarModelDelegate implementation: | 22 // Returns active WebContents. |
22 std::string GetAcceptLanguages() const override; | 23 virtual content::WebContents* GetActiveWebContents() const = 0; |
23 base::string16 FormattedStringWithEquivalentMeaning( | |
24 const GURL& url, | |
25 const base::string16& formatted_url) const override; | |
26 | 24 |
27 protected: | 25 protected: |
28 ChromeToolbarModelDelegate(); | 26 ChromeToolbarModelDelegate(); |
29 ~ChromeToolbarModelDelegate() override; | 27 ~ChromeToolbarModelDelegate() override; |
30 | 28 |
31 private: | 29 private: |
| 30 // ToolbarModelDelegate implementation: |
| 31 std::string GetAcceptLanguages() const override; |
| 32 base::string16 FormattedStringWithEquivalentMeaning( |
| 33 const GURL& url, |
| 34 const base::string16& formatted_url) const override; |
| 35 bool GetURL(GURL* url) const override; |
| 36 bool ShouldDisplayURL() const override; |
| 37 SecurityLevel GetSecurityLevel() const override; |
| 38 base::string16 GetSearchTerms(SecurityLevel security_level) const override; |
| 39 scoped_refptr<net::X509Certificate> GetCertificate() const override; |
| 40 |
32 // Returns the navigation controller used to retrieve the navigation entry | 41 // Returns the navigation controller used to retrieve the navigation entry |
33 // from which the states are retrieved. If this returns null, default values | 42 // from which the states are retrieved. If this returns null, default values |
34 // are used. | 43 // are used. |
35 content::NavigationController* GetNavigationController() const; | 44 content::NavigationController* GetNavigationController() const; |
36 | 45 |
| 46 // Helper method to extract the navigation entry from the navigation |
| 47 // controller. |
| 48 content::NavigationEntry* GetNavigationEntry() const; |
| 49 |
37 // Helper method to extract the profile from the navigation controller. | 50 // Helper method to extract the profile from the navigation controller. |
38 Profile* GetProfile() const; | 51 Profile* GetProfile() const; |
39 | 52 |
40 DISALLOW_COPY_AND_ASSIGN(ChromeToolbarModelDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(ChromeToolbarModelDelegate); |
41 }; | 54 }; |
42 | 55 |
43 #endif // CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_DELEGATE_H_ | 56 #endif // CHROME_BROWSER_UI_TOOLBAR_CHROME_TOOLBAR_MODEL_DELEGATE_H_ |
OLD | NEW |