| 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 26 matching lines...) Expand all Loading... |
| 37 // engine, the query will be extracted and returned for display instead | 37 // engine, the query will be extracted and returned for display instead |
| 38 // of the URL. | 38 // of the URL. |
| 39 // - If the origin chip is enabled and visible, the text will be empty. | 39 // - If the origin chip is enabled and visible, the text will be empty. |
| 40 // - Otherwise, the text will contain the URL returned by GetFormattedURL(). | 40 // - Otherwise, the text will contain the URL returned by GetFormattedURL(). |
| 41 virtual base::string16 GetText() const = 0; | 41 virtual base::string16 GetText() const = 0; |
| 42 | 42 |
| 43 // Returns a formatted URL for display in the toolbar. The formatting | 43 // Returns a formatted URL for display in the toolbar. The formatting |
| 44 // includes: | 44 // includes: |
| 45 // - Some characters may be unescaped. | 45 // - Some characters may be unescaped. |
| 46 // - The scheme and/or trailing slash may be dropped. | 46 // - The scheme and/or trailing slash may be dropped. |
| 47 virtual base::string16 GetFormattedURL() const = 0; | 47 // If |prefix_end| is non-NULL, it is set to the length of the pre-hostname |
| 48 // portion of the resulting URL. |
| 49 virtual base::string16 GetFormattedURL(size_t* prefix_end) const = 0; |
| 48 | 50 |
| 49 // Some search URLs bundle a special "corpus" param that we can extract and | 51 // Some search URLs bundle a special "corpus" param that we can extract and |
| 50 // display next to users' search terms in cases where we'd show the search | 52 // display next to users' search terms in cases where we'd show the search |
| 51 // terms instead of the URL anyway. For example, a Google image search might | 53 // terms instead of the URL anyway. For example, a Google image search might |
| 52 // show the corpus "Images:" plus a search string. This is only used on | 54 // show the corpus "Images:" plus a search string. This is only used on |
| 53 // mobile. | 55 // mobile. |
| 54 virtual base::string16 GetCorpusNameForMobile() const = 0; | 56 virtual base::string16 GetCorpusNameForMobile() const = 0; |
| 55 | 57 |
| 56 // Returns the URL of the current navigation entry. | 58 // Returns the URL of the current navigation entry. |
| 57 virtual GURL GetURL() const = 0; | 59 virtual GURL GetURL() const = 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 // 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, |
| 77 // based on the current URL. When search term replacement is active, this | 79 // based on the current URL. When search term replacement is active, this |
| 78 // returns a search icon. This doesn't cover specialized icons while the | 80 // returns a search icon. This doesn't cover specialized icons while the |
| 79 // user is editing; see OmniboxView::GetIcon(). | 81 // user is editing; see OmniboxView::GetIcon(). |
| 80 virtual int GetIcon() const = 0; | 82 virtual int GetIcon() const = 0; |
| 81 | 83 |
| 82 // As |GetIcon()|, but returns the icon only taking into account the security | 84 // As |GetIcon()|, but returns the icon only taking into account the security |
| 83 // |level| given, ignoring search term replacement state. | 85 // |level| given, ignoring search term replacement state. |
| 84 virtual int GetIconForSecurityLevel(SecurityLevel level) const = 0; | 86 virtual int GetIconForSecurityLevel(SecurityLevel level) const = 0; |
| 85 | 87 |
| 86 // Returns the name of the EV cert holder. Only call this when the security | 88 // Returns the name of the EV cert holder. This returns an empty string if |
| 87 // level is EV_SECURE. | 89 // the security level is not EV_SECURE. |
| 88 virtual base::string16 GetEVCertName() const = 0; | 90 virtual base::string16 GetEVCertName() const = 0; |
| 89 | 91 |
| 90 // Returns whether the URL for the current navigation entry should be | 92 // Returns whether the URL for the current navigation entry should be |
| 91 // in the location bar. | 93 // in the location bar. |
| 92 virtual bool ShouldDisplayURL() const = 0; | 94 virtual bool ShouldDisplayURL() const = 0; |
| 93 | 95 |
| 94 // Returns true if a call to GetText() would return an empty string instead of | 96 // Returns true if a call to GetText() would return an empty string instead of |
| 95 // the URL that would have otherwise been displayed because the host/origin is | 97 // the URL that would have otherwise been displayed because the host/origin is |
| 96 // instead being displayed in the origin chip. This returns false when we | 98 // instead being displayed in the origin chip. This returns false when we |
| 97 // wouldn't have displayed a URL to begin with (e.g. for the NTP). | 99 // wouldn't have displayed a URL to begin with (e.g. for the NTP). |
| (...skipping 30 matching lines...) Expand all Loading... |
| 128 | 130 |
| 129 private: | 131 private: |
| 130 bool input_in_progress_; | 132 bool input_in_progress_; |
| 131 bool origin_chip_enabled_; | 133 bool origin_chip_enabled_; |
| 132 bool url_replacement_enabled_; | 134 bool url_replacement_enabled_; |
| 133 | 135 |
| 134 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); | 136 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 139 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
| OLD | NEW |