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

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

Issue 14259008: Instant Extended: Add prominent search term support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 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 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 11 matching lines...) Expand all
22 public: 22 public:
23 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We 23 // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We
24 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED 24 // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED
25 // needs to be refined into three levels: warning, standard, and EV. 25 // needs to be refined into three levels: warning, standard, and EV.
26 enum SecurityLevel { 26 enum SecurityLevel {
27 #define DEFINE_TOOLBAR_MODEL_SECURITY_LEVEL(name,value) name = value, 27 #define DEFINE_TOOLBAR_MODEL_SECURITY_LEVEL(name,value) name = value,
28 #include "chrome/browser/ui/toolbar/toolbar_model_security_level_list.h" 28 #include "chrome/browser/ui/toolbar/toolbar_model_security_level_list.h"
29 #undef DEFINE_TOOLBAR_MODEL_SECURITY_LEVEL 29 #undef DEFINE_TOOLBAR_MODEL_SECURITY_LEVEL
30 }; 30 };
31 31
32 // If search URLs may be displayed as search terms, these are the types of
33 // search terms that may be extracted from the URL. See comments on GetText()
34 // and GetSearchTermsType().
35 enum SearchTermsType {
36 // There are no search terms.
37 NO_SEARCH_TERMS,
38 // There are regular search terms.
39 NORMAL_SEARCH_TERMS,
40 // There are search terms that require a more prominent UI. For example,
41 // if the search term looks like a URL then it should be clear to the user
42 // that a search term is being displayed.
43 URL_LIKE_SEARCH_TERMS
Peter Kasting 2013/04/25 22:48:39 Tiny nit: I like leaving a trailing comma here for
sail 2013/04/25 23:39:16 Done.
44 };
45
32 virtual ~ToolbarModel() {} 46 virtual ~ToolbarModel() {}
33 47
34 // Returns the text for the current page's URL. This will have been formatted 48 // Returns the text for the current page's URL. This will have been formatted
35 // for display to the user: 49 // for display to the user:
36 // - Some characters may be unescaped. 50 // - Some characters may be unescaped.
37 // - The scheme and/or trailing slash may be dropped. 51 // - The scheme and/or trailing slash may be dropped.
38 // - if |display_search_urls_as_search_terms| is true, the query will be 52 // - if |display_search_urls_as_search_terms| is true, the query will be
39 // extracted from search URLs for the user's default search engine and those 53 // extracted from search URLs for the user's default search engine and those
40 // will be displayed in place of the URL. 54 // will be displayed in place of the URL.
41 virtual string16 GetText(bool display_search_urls_as_search_terms) const = 0; 55 virtual string16 GetText(bool display_search_urls_as_search_terms) const = 0;
42 56
43 // Some search URLs bundle a special "corpus" param that we can extract and 57 // Some search URLs bundle a special "corpus" param that we can extract and
44 // display next to users' search terms in cases where we'd show the search 58 // display next to users' search terms in cases where we'd show the search
45 // terms instead of the URL anyway. For example, a Google image search might 59 // terms instead of the URL anyway. For example, a Google image search might
46 // show the corpus "Images:" plus a search string. This is only used on 60 // show the corpus "Images:" plus a search string. This is only used on
47 // mobile. 61 // mobile.
48 virtual string16 GetCorpusNameForMobile() const = 0; 62 virtual string16 GetCorpusNameForMobile() const = 0;
49 63
50 // Returns the URL of the current navigation entry. 64 // Returns the URL of the current navigation entry.
51 virtual GURL GetURL() const = 0; 65 virtual GURL GetURL() const = 0;
52 66
53 // Returns true if a call to GetText(true) would successfully replace the URL 67 // This indicates the type of search terms returned by a call to
54 // with search terms. 68 // GetText(true).
55 virtual bool WouldReplaceSearchURLWithSearchTerms() const = 0; 69 virtual SearchTermsType GetSearchTermsType() const = 0;
70
71 // Setter for whether the UI can display a more prominent UI for search terms
72 // that require it.
Peter Kasting 2013/04/25 22:48:39 Nit: Update comment to not talk about UI
sail 2013/04/25 23:39:16 Done.
73 virtual void SetSupportsExtractionOfURLLikeSearchTerms(bool value) = 0;
56 74
57 // Returns the security level that the toolbar should display. 75 // Returns the security level that the toolbar should display.
58 virtual SecurityLevel GetSecurityLevel() const = 0; 76 virtual SecurityLevel GetSecurityLevel() const = 0;
59 77
60 // Returns the resource_id of the icon to show to the left of the address, 78 // Returns the resource_id of the icon to show to the left of the address,
61 // based on the current URL. This doesn't cover specialized icons while the 79 // based on the current URL. This doesn't cover specialized icons while the
62 // user is editing; see OmniboxView::GetIcon(). 80 // user is editing; see OmniboxView::GetIcon().
63 virtual int GetIcon() const = 0; 81 virtual int GetIcon() const = 0;
64 82
65 // Returns the name of the EV cert holder. Only call this when the security 83 // Returns the name of the EV cert holder. Only call this when the security
66 // level is EV_SECURE. 84 // level is EV_SECURE.
67 virtual string16 GetEVCertName() const = 0; 85 virtual string16 GetEVCertName() const = 0;
68 86
69 // Returns whether the URL for the current navigation entry should be 87 // Returns whether the URL for the current navigation entry should be
70 // in the location bar. 88 // in the location bar.
71 virtual bool ShouldDisplayURL() const = 0; 89 virtual bool ShouldDisplayURL() const = 0;
72 90
73 // Getter/setter of whether the text in location bar is currently being 91 // Getter/setter of whether the text in location bar is currently being
74 // edited. 92 // edited.
75 virtual void SetInputInProgress(bool value) = 0; 93 virtual void SetInputInProgress(bool value) = 0;
76 virtual bool GetInputInProgress() const = 0; 94 virtual bool GetInputInProgress() const = 0;
77 95
78 protected: 96 protected:
79 ToolbarModel() {} 97 ToolbarModel() {}
80 }; 98 };
81 99
82 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ 100 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698