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