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 17 matching lines...) Expand all Loading... |
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 virtual ~ToolbarModel() {} | 32 virtual ~ToolbarModel() {} |
33 | 33 |
34 // Returns the text for the current page's URL. This will have been formatted | 34 // Returns the text for the current page's URL. This will have been formatted |
35 // for display to the user: | 35 // for display to the user: |
36 // - Some characters may be unescaped. | 36 // - Some characters may be unescaped. |
37 // - The scheme and/or trailing slash may be dropped. | 37 // - The scheme and/or trailing slash may be dropped. |
38 // - if |allow_search_term_replacement| is true, the query will be extracted | 38 // - If the current page's URL is a search URL for the user's default search |
39 // from search URLs for the user's default search engine and will be | 39 // engine, the query will be extracted and returned. |
40 // displayed in place of the URL. | 40 virtual string16 GetText() const = 0; |
41 virtual string16 GetText(bool allow_search_term_replacement) const = 0; | |
42 | 41 |
43 // Some search URLs bundle a special "corpus" param that we can extract and | 42 // 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 | 43 // 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 | 44 // 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 | 45 // show the corpus "Images:" plus a search string. This is only used on |
47 // mobile. | 46 // mobile. |
48 virtual string16 GetCorpusNameForMobile() const = 0; | 47 virtual string16 GetCorpusNameForMobile() const = 0; |
49 | 48 |
50 // Returns the URL of the current navigation entry. | 49 // Returns the URL of the current navigation entry. |
51 virtual GURL GetURL() const = 0; | 50 virtual GURL GetURL() const = 0; |
52 | 51 |
53 // Returns true if a call to GetText(true) would successfully replace the URL | 52 // Returns true if a call to GetText() would successfully replace the URL |
54 // with search terms. If |ignore_editing| is true, the result reflects the | 53 // with search terms. If |ignore_editing| is true, the result reflects the |
55 // underlying state of the page without regard to any user edits that may be | 54 // underlying state of the page without regard to any user edits that may be |
56 // in progress in the omnibox. | 55 // in progress in the omnibox. |
57 virtual bool WouldPerformSearchTermReplacement(bool ignore_editing) const = 0; | 56 virtual bool WouldPerformSearchTermReplacement(bool ignore_editing) const = 0; |
58 | 57 |
59 // Returns the security level that the toolbar should display. If | 58 // Returns the security level that the toolbar should display. If |
60 // |ignore_editing| is true, the result reflects the underlying state of the | 59 // |ignore_editing| is true, the result reflects the underlying state of the |
61 // page without regard to any user edits that may be in progress in the | 60 // page without regard to any user edits that may be in progress in the |
62 // omnibox. | 61 // omnibox. |
63 virtual SecurityLevel GetSecurityLevel(bool ignore_editing) const = 0; | 62 virtual SecurityLevel GetSecurityLevel(bool ignore_editing) const = 0; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 search_term_replacement_enabled_(true) {} | 94 search_term_replacement_enabled_(true) {} |
96 | 95 |
97 private: | 96 private: |
98 bool input_in_progress_; | 97 bool input_in_progress_; |
99 bool search_term_replacement_enabled_; | 98 bool search_term_replacement_enabled_; |
100 | 99 |
101 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); | 100 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); |
102 }; | 101 }; |
103 | 102 |
104 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ | 103 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_H_ |
OLD | NEW |