Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model.h

Issue 9479008: Re-factor location bar/toolbar code to get rid of the browser dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call right overloaded method Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 13
14 class Browser; 14 class ToolbarModelDelegate;
15 15
16 namespace content { 16 namespace content {
17 class NavigationController; 17 class NavigationController;
18 } 18 }
19 19
20 namespace net { 20 namespace net {
21 class X509Certificate; 21 class X509Certificate;
22 } 22 }
23 23
24 // This class is the model used by the toolbar, location bar and autocomplete 24 // 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 25 // edit. It populates its states from the current navigation entry retrieved
26 // from the navigation controller returned by GetNavigationController(). 26 // from the navigation controller returned by GetNavigationController().
27 class ToolbarModel { 27 class ToolbarModel {
28 public: 28 public:
29 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We 29 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We
30 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED 30 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED
31 // needs to be refined into three levels: warning, standard, and EV. 31 // needs to be refined into three levels: warning, standard, and EV.
32 enum SecurityLevel { 32 enum SecurityLevel {
33 NONE = 0, // HTTP/no URL/user is editing 33 NONE = 0, // HTTP/no URL/user is editing
34 EV_SECURE, // HTTPS with valid EV cert 34 EV_SECURE, // HTTPS with valid EV cert
35 SECURE, // HTTPS (non-EV) 35 SECURE, // HTTPS (non-EV)
36 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation 36 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation
37 // status or with insecure content on the page 37 // status or with insecure content on the page
38 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated 38 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated
39 NUM_SECURITY_LEVELS, 39 NUM_SECURITY_LEVELS,
40 }; 40 };
41 41
42 explicit ToolbarModel(Browser* browser); 42 explicit ToolbarModel(ToolbarModelDelegate* delegate);
43 ~ToolbarModel(); 43 ~ToolbarModel();
44 44
45 // Returns the text that should be displayed in the location bar. 45 // Returns the text that should be displayed in the location bar.
46 string16 GetText() const; 46 string16 GetText() const;
47 47
48 // Returns the security level that the toolbar should display. 48 // Returns the security level that the toolbar should display.
49 SecurityLevel GetSecurityLevel() const; 49 SecurityLevel GetSecurityLevel() const;
50 50
51 // Returns the resource_id of the icon to show to the left of the address, 51 // Returns the resource_id of the icon to show to the left of the address,
52 // based on the current URL. This doesn't cover specialized icons while the 52 // based on the current URL. This doesn't cover specialized icons while the
(...skipping 15 matching lines...) Expand all
68 68
69 // Returns "<organization_name> [<country>]". 69 // Returns "<organization_name> [<country>]".
70 static string16 GetEVCertName(const net::X509Certificate& cert); 70 static string16 GetEVCertName(const net::X509Certificate& cert);
71 71
72 private: 72 private:
73 // Returns the navigation controller used to retrieve the navigation entry 73 // Returns the navigation controller used to retrieve the navigation entry
74 // from which the states are retrieved. 74 // from which the states are retrieved.
75 // If this returns NULL, default values are used. 75 // If this returns NULL, default values are used.
76 content::NavigationController* GetNavigationController() const; 76 content::NavigationController* GetNavigationController() const;
77 77
78 Browser* browser_; 78 ToolbarModelDelegate* delegate_;
79 79
80 // Whether the text in the location bar is currently being edited. 80 // Whether the text in the location bar is currently being edited.
81 bool input_in_progress_; 81 bool input_in_progress_;
82 82
83 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); 83 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel);
84 }; 84 };
85 85
86 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ 86 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/ui/toolbar/toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698