| 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 COMPONENTS_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 5 #ifndef COMPONENTS_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ |
| 6 #define COMPONENTS_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 6 #define COMPONENTS_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "components/toolbar/toolbar_model.h" | 15 #include "components/toolbar/toolbar_model.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 class ToolbarModelDelegate; | 18 class ToolbarModelDelegate; |
| 19 | 19 |
| 20 namespace net { | |
| 21 class X509Certificate; | |
| 22 } | |
| 23 | |
| 24 // This class is the model used by the toolbar, location bar and autocomplete | 20 // 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 | 21 // edit. It populates its states from the current navigation entry retrieved |
| 26 // from the navigation controller returned by GetNavigationController(). | 22 // from the navigation controller returned by GetNavigationController(). |
| 27 class ToolbarModelImpl : public ToolbarModel { | 23 class ToolbarModelImpl : public ToolbarModel { |
| 28 public: | 24 public: |
| 29 ToolbarModelImpl(ToolbarModelDelegate* delegate, | 25 ToolbarModelImpl(ToolbarModelDelegate* delegate, |
| 30 size_t max_url_display_chars); | 26 size_t max_url_display_chars); |
| 31 ~ToolbarModelImpl() override; | 27 ~ToolbarModelImpl() override; |
| 32 | 28 |
| 33 private: | 29 private: |
| 34 // ToolbarModel: | 30 // ToolbarModel: |
| 35 base::string16 GetText() const override; | |
| 36 base::string16 GetFormattedURL(size_t* prefix_end) const override; | 31 base::string16 GetFormattedURL(size_t* prefix_end) const override; |
| 37 GURL GetURL() const override; | 32 GURL GetURL() const override; |
| 38 bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; | |
| 39 security_state::SecurityStateModel::SecurityLevel GetSecurityLevel( | 33 security_state::SecurityStateModel::SecurityLevel GetSecurityLevel( |
| 40 bool ignore_editing) const override; | 34 bool ignore_editing) const override; |
| 41 int GetIcon() const override; | 35 int GetIcon() const override; |
| 42 gfx::VectorIconId GetVectorIcon() const override; | 36 gfx::VectorIconId GetVectorIcon() const override; |
| 43 base::string16 GetEVCertName() const override; | 37 base::string16 GetEVCertName() const override; |
| 44 bool ShouldDisplayURL() const override; | 38 bool ShouldDisplayURL() const override; |
| 45 | 39 |
| 46 // Returns search terms as in search::GetSearchTerms() if such terms should | |
| 47 // appear in the omnibox (i.e. the page is sufficiently secure, search term | |
| 48 // replacement is enabled, editing is not in progress, etc.). If | |
| 49 // |ignore_editing| is true, the "editing not in progress" check is skipped. | |
| 50 base::string16 GetSearchTerms(bool ignore_editing) const; | |
| 51 | |
| 52 ToolbarModelDelegate* delegate_; | 40 ToolbarModelDelegate* delegate_; |
| 53 const size_t max_url_display_chars_; | 41 const size_t max_url_display_chars_; |
| 54 | 42 |
| 55 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl); | 43 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl); |
| 56 }; | 44 }; |
| 57 | 45 |
| 58 #endif // COMPONENTS_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ | 46 #endif // COMPONENTS_TOOLBAR_TOOLBAR_MODEL_IMPL_H_ |
| OLD | NEW |