Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 enum SearchTermType { | |
|
Peter Kasting
2013/04/25 19:42:54
Nit: Add comment above enum:
If search URLs may b
sail
2013/04/25 22:18:46
Done.
| |
| 33 // There are no search terms. | |
| 34 SEARCH_TERM_NONE, | |
| 35 // There are regular search terms. | |
| 36 SEARCH_TERM_NORMAL, | |
| 37 // There are search terms that require a more prominent UI. For example, | |
| 38 // if the search term looks like a URL then it should be clear to the user | |
| 39 // that a search term is being displayed. | |
| 40 SEARCH_TERM_PROMINENT, | |
|
Peter Kasting
2013/04/25 19:42:54
I think these would make more sense named as:
NO_
sail
2013/04/25 22:18:46
Done.
| |
| 41 }; | |
| 42 | |
| 32 virtual ~ToolbarModel() {} | 43 virtual ~ToolbarModel() {} |
| 33 | 44 |
| 34 // Returns the text for the current page's URL. This will have been formatted | 45 // Returns the text for the current page's URL. This will have been formatted |
| 35 // for display to the user: | 46 // for display to the user: |
| 36 // - Some characters may be unescaped. | 47 // - Some characters may be unescaped. |
| 37 // - The scheme and/or trailing slash may be dropped. | 48 // - The scheme and/or trailing slash may be dropped. |
| 38 // - if |display_search_urls_as_search_terms| is true, the query will be | 49 // - 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 | 50 // extracted from search URLs for the user's default search engine and those |
| 40 // will be displayed in place of the URL. | 51 // will be displayed in place of the URL. |
| 41 virtual string16 GetText(bool display_search_urls_as_search_terms) const = 0; | 52 virtual string16 GetText(bool display_search_urls_as_search_terms) const = 0; |
| 42 | 53 |
| 43 // Some search URLs bundle a special "corpus" param that we can extract and | 54 // 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 | 55 // 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 | 56 // 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 | 57 // show the corpus "Images:" plus a search string. This is only used on |
| 47 // mobile. | 58 // mobile. |
| 48 virtual string16 GetCorpusNameForMobile() const = 0; | 59 virtual string16 GetCorpusNameForMobile() const = 0; |
| 49 | 60 |
| 50 // Returns the URL of the current navigation entry. | 61 // Returns the URL of the current navigation entry. |
| 51 virtual GURL GetURL() const = 0; | 62 virtual GURL GetURL() const = 0; |
| 52 | 63 |
| 53 // Returns true if a call to GetText(true) would successfully replace the URL | 64 // This indicates the type of search terms returned by a call to |
| 54 // with search terms. | 65 // GetText(true). |
| 55 virtual bool WouldReplaceSearchURLWithSearchTerms() const = 0; | 66 virtual SearchTermType GetSearchTermType() const = 0; |
|
Peter Kasting
2013/04/25 19:42:54
Tiny nit: GetSearchTermsType() seems more correct
sail
2013/04/25 22:18:46
Done.
| |
| 67 | |
| 68 // Setter for whether the UI can display a more prominent UI for search terms | |
| 69 // that require it. | |
| 70 virtual void SetIsProminentSearchTermUISupported(bool value) = 0; | |
|
Peter Kasting
2013/04/25 19:42:54
With the enum naming change above, this would beco
sail
2013/04/25 22:18:46
Done.
| |
| 56 | 71 |
| 57 // Returns the security level that the toolbar should display. | 72 // Returns the security level that the toolbar should display. |
| 58 virtual SecurityLevel GetSecurityLevel() const = 0; | 73 virtual SecurityLevel GetSecurityLevel() const = 0; |
| 59 | 74 |
| 60 // Returns the resource_id of the icon to show to the left of the address, | 75 // 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 | 76 // based on the current URL. This doesn't cover specialized icons while the |
| 62 // user is editing; see OmniboxView::GetIcon(). | 77 // user is editing; see OmniboxView::GetIcon(). |
| 63 virtual int GetIcon() const = 0; | 78 virtual int GetIcon() const = 0; |
| 64 | 79 |
| 65 // Returns the name of the EV cert holder. Only call this when the security | 80 // Returns the name of the EV cert holder. Only call this when the security |
| 66 // level is EV_SECURE. | 81 // level is EV_SECURE. |
| 67 virtual string16 GetEVCertName() const = 0; | 82 virtual string16 GetEVCertName() const = 0; |
| 68 | 83 |
| 69 // Returns whether the URL for the current navigation entry should be | 84 // Returns whether the URL for the current navigation entry should be |
| 70 // in the location bar. | 85 // in the location bar. |
| 71 virtual bool ShouldDisplayURL() const = 0; | 86 virtual bool ShouldDisplayURL() const = 0; |
| 72 | 87 |
| 73 // Getter/setter of whether the text in location bar is currently being | 88 // Getter/setter of whether the text in location bar is currently being |
| 74 // edited. | 89 // edited. |
| 75 virtual void SetInputInProgress(bool value) = 0; | 90 virtual void SetInputInProgress(bool value) = 0; |
| 76 virtual bool GetInputInProgress() const = 0; | 91 virtual bool GetInputInProgress() const = 0; |
| 77 | 92 |
| 78 protected: | 93 protected: |
| 79 ToolbarModel() {} | 94 ToolbarModel() {} |
| 80 }; | 95 }; |
| 81 | 96 |
| 82 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 97 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| OLD | NEW |