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

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

Issue 11040055: Adds a FakeToolbarModel for use in testing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 23 matching lines...) Expand all
34 NONE = 0, // HTTP/no URL/user is editing 34 NONE = 0, // HTTP/no URL/user is editing
35 EV_SECURE, // HTTPS with valid EV cert 35 EV_SECURE, // HTTPS with valid EV cert
36 SECURE, // HTTPS (non-EV) 36 SECURE, // HTTPS (non-EV)
37 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation 37 SECURITY_WARNING, // HTTPS, but unable to check certificate revocation
38 // status or with insecure content on the page 38 // status or with insecure content on the page
39 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated 39 SECURITY_ERROR, // Attempted HTTPS and failed, page not authenticated
40 NUM_SECURITY_LEVELS, 40 NUM_SECURITY_LEVELS,
41 }; 41 };
42 42
43 explicit ToolbarModel(ToolbarModelDelegate* delegate); 43 explicit ToolbarModel(ToolbarModelDelegate* delegate);
44 ~ToolbarModel(); 44 virtual ~ToolbarModel();
45 45
46 // Returns the text for the current page's URL. This will have been formatted 46 // Returns the text for the current page's URL. This will have been formatted
47 // for display to the user: 47 // for display to the user:
48 // - Some characters may be unescaped. 48 // - Some characters may be unescaped.
49 // - The scheme and/or trailing slash may be dropped. 49 // - The scheme and/or trailing slash may be dropped.
50 // - if |display_search_urls_as_search_terms| is true, the query will be 50 // - if |display_search_urls_as_search_terms| is true, the query will be
51 // extracted from search URLs for the user's default search engine and those 51 // extracted from search URLs for the user's default search engine and those
52 // will be displayed in place of the URL. 52 // will be displayed in place of the URL.
53 string16 GetText(bool display_search_urls_as_search_terms) const; 53 virtual string16 GetText(bool display_search_urls_as_search_terms) const;
54 54
55 // Returns the URL of the current navigation entry. 55 // Returns the URL of the current navigation entry.
56 GURL GetURL() const; 56 virtual GURL GetURL() const;
57 57
58 // Returns true if a call to GetText(true) would successfully replace the URL 58 // Returns true if a call to GetText(true) would successfully replace the URL
59 // with search terms. 59 // with search terms.
60 bool WouldReplaceSearchURLWithSearchTerms() const; 60 virtual bool WouldReplaceSearchURLWithSearchTerms() const;
61 61
62 // Returns the security level that the toolbar should display. 62 // Returns the security level that the toolbar should display.
63 SecurityLevel GetSecurityLevel() const; 63 virtual SecurityLevel GetSecurityLevel() const;
64 64
65 // Returns the resource_id of the icon to show to the left of the address, 65 // Returns the resource_id of the icon to show to the left of the address,
66 // based on the current URL. This doesn't cover specialized icons while the 66 // based on the current URL. This doesn't cover specialized icons while the
67 // user is editing; see OmniboxView::GetIcon(). 67 // user is editing; see OmniboxView::GetIcon().
68 int GetIcon() const; 68 virtual int GetIcon() const;
69 69
70 // Returns the name of the EV cert holder. Only call this when the security 70 // Returns the name of the EV cert holder. Only call this when the security
71 // level is EV_SECURE. 71 // level is EV_SECURE.
72 string16 GetEVCertName() const; 72 virtual string16 GetEVCertName() const;
73 73
74 // Returns whether the URL for the current navigation entry should be 74 // Returns whether the URL for the current navigation entry should be
75 // in the location bar. 75 // in the location bar.
76 bool ShouldDisplayURL() const; 76 virtual bool ShouldDisplayURL() const;
77 77
78 // Getter/setter of whether the text in location bar is currently being 78 // Getter/setter of whether the text in location bar is currently being
79 // edited. 79 // edited.
80 void set_input_in_progress(bool value) { input_in_progress_ = value; } 80 void set_input_in_progress(bool value) { input_in_progress_ = value; }
81 bool input_in_progress() const { return input_in_progress_; } 81 bool input_in_progress() const { return input_in_progress_; }
82 82
83 // Returns "<organization_name> [<country>]". 83 // Returns "<organization_name> [<country>]".
84 static string16 GetEVCertName(const net::X509Certificate& cert); 84 static string16 GetEVCertName(const net::X509Certificate& cert);
85 85
86 private: 86 private:
(...skipping 12 matching lines...) Expand all
99 99
100 ToolbarModelDelegate* delegate_; 100 ToolbarModelDelegate* delegate_;
101 101
102 // Whether the text in the location bar is currently being edited. 102 // Whether the text in the location bar is currently being edited.
103 bool input_in_progress_; 103 bool input_in_progress_;
104 104
105 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel); 105 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModel);
106 }; 106 };
107 107
108 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ 108 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698