Add a minor text member to ui::MenuModel.
[chromium-blink-merge.git] / chrome / browser / ui / toolbar / toolbar_model_impl.h
blobe86f3fe8f3bd5e0d8268b91b2883744ae3af7d9d
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.
5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/strings/string16.h"
13 #include "chrome/browser/ui/toolbar/toolbar_model.h"
14 #include "url/gurl.h"
16 class Profile;
17 class ToolbarModelDelegate;
19 namespace content {
20 class NavigationController;
21 class WebContents;
24 namespace net {
25 class X509Certificate;
28 // This class is the model used by the toolbar, location bar and autocomplete
29 // edit. It populates its states from the current navigation entry retrieved
30 // from the navigation controller returned by GetNavigationController().
31 class ToolbarModelImpl : public ToolbarModel {
32 public:
33 explicit ToolbarModelImpl(ToolbarModelDelegate* delegate);
34 virtual ~ToolbarModelImpl();
36 static SecurityLevel GetSecurityLevelForWebContents(
37 content::WebContents* web_contents);
39 // Overriden from ToolbarModel.
40 virtual string16 GetText(
41 bool display_search_urls_as_search_terms) const OVERRIDE;
42 virtual string16 GetCorpusNameForMobile() const OVERRIDE;
43 virtual GURL GetURL() const OVERRIDE;
44 virtual bool WouldReplaceSearchURLWithSearchTerms(
45 bool ignore_editing) const OVERRIDE;
46 virtual SecurityLevel GetSecurityLevel(bool ignore_editing) const OVERRIDE;
47 virtual int GetIcon() const OVERRIDE;
48 virtual string16 GetEVCertName() const OVERRIDE;
49 virtual bool ShouldDisplayURL() const OVERRIDE;
51 // Returns "<organization_name> [<country>]".
52 static string16 GetEVCertName(const net::X509Certificate& cert);
54 private:
55 // Returns the navigation controller used to retrieve the navigation entry
56 // from which the states are retrieved.
57 // If this returns NULL, default values are used.
58 content::NavigationController* GetNavigationController() const;
60 // Helper method to extract the profile from the navigation controller.
61 Profile* GetProfile() const;
63 // Returns search terms as in chrome::GetSearchTerms() unless the page is
64 // insufficiently secure. If |ignore_editing| is true, the result reflects
65 // the underlying state of the page without regard to any user edits that
66 // may be in progress in the omnibox.
67 string16 GetSearchTerms(bool ignore_editing) const;
69 ToolbarModelDelegate* delegate_;
71 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelImpl);
74 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_IMPL_H_