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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace net { | 25 namespace net { |
26 class X509Certificate; | 26 class X509Certificate; |
27 } | 27 } |
28 | 28 |
29 // 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 |
30 // edit. It populates its states from the current navigation entry retrieved | 30 // edit. It populates its states from the current navigation entry retrieved |
31 // from the navigation controller returned by GetNavigationController(). | 31 // from the navigation controller returned by GetNavigationController(). |
32 class ToolbarModelImpl : public ToolbarModel { | 32 class ToolbarModelImpl : public ToolbarModel { |
33 public: | 33 public: |
34 explicit ToolbarModelImpl(ToolbarModelDelegate* delegate); | 34 ToolbarModelImpl(ToolbarModelDelegate* delegate, |
| 35 size_t max_url_display_chars); |
35 ~ToolbarModelImpl() override; | 36 ~ToolbarModelImpl() override; |
36 | 37 |
37 private: | 38 private: |
38 // ToolbarModel: | 39 // ToolbarModel: |
39 base::string16 GetText() const override; | 40 base::string16 GetText() const override; |
40 base::string16 GetFormattedURL(size_t* prefix_end) const override; | 41 base::string16 GetFormattedURL(size_t* prefix_end) const override; |
41 base::string16 GetCorpusNameForMobile() const override; | 42 base::string16 GetCorpusNameForMobile() const override; |
42 GURL GetURL() const override; | 43 GURL GetURL() const override; |
43 bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; | 44 bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; |
44 security_state::SecurityStateModel::SecurityLevel GetSecurityLevel( | 45 security_state::SecurityStateModel::SecurityLevel GetSecurityLevel( |
45 bool ignore_editing) const override; | 46 bool ignore_editing) const override; |
46 int GetIcon() const override; | 47 int GetIcon() const override; |
47 gfx::VectorIconId GetVectorIcon() const override; | 48 gfx::VectorIconId GetVectorIcon() const override; |
48 base::string16 GetEVCertName() const override; | 49 base::string16 GetEVCertName() const override; |
49 bool ShouldDisplayURL() const override; | 50 bool ShouldDisplayURL() const override; |
50 | 51 |
51 // Returns the navigation controller used to retrieve the navigation entry | |
52 // from which the states are retrieved. | |
53 // If this returns NULL, default values are used. | |
54 content::NavigationController* GetNavigationController() const; | |
55 | |
56 // Returns search terms as in search::GetSearchTerms() if such terms should | 52 // Returns search terms as in search::GetSearchTerms() if such terms should |
57 // appear in the omnibox (i.e. the page is sufficiently secure, search term | 53 // appear in the omnibox (i.e. the page is sufficiently secure, search term |
58 // replacement is enabled, editing is not in progress, etc.). If | 54 // replacement is enabled, editing is not in progress, etc.). If |
59 // |ignore_editing| is true, the "editing not in progress" check is skipped. | 55 // |ignore_editing| is true, the "editing not in progress" check is skipped. |
60 base::string16 GetSearchTerms(bool ignore_editing) const; | 56 base::string16 GetSearchTerms(bool ignore_editing) const; |
61 | 57 |
62 ToolbarModelDelegate* delegate_; | 58 ToolbarModelDelegate* delegate_; |
| 59 const size_t max_url_display_chars_; |
63 | 60 |
64 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl); |
65 }; | 62 }; |
66 | 63 |
67 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 64 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ |
OLD | NEW |