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_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 5 #ifndef CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser. | 102 // Sends ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem to the browser. |
103 void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); | 103 void DeleteMostVisitedItem(InstantRestrictedID most_visited_item_id); |
104 | 104 |
105 // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser. | 105 // Sends ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion to the browser. |
106 void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); | 106 void UndoMostVisitedDeletion(InstantRestrictedID most_visited_item_id); |
107 | 107 |
108 // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the | 108 // Sends ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions to the |
109 // browser. | 109 // browser. |
110 void UndoAllMostVisitedDeletions(); | 110 void UndoAllMostVisitedDeletions(); |
111 | 111 |
112 // Generates a data:// URL containing the HTML required to display a result. | |
113 bool GenerateDataURLForSuggestionRequest(const GURL& request_url, | |
114 GURL* data_url) const; | |
115 | |
116 // Sets the InstantAutocompleteResultStyle to the input value. | |
117 void SetInstantAutocompleteResultStyle( | |
118 const InstantAutocompleteResultStyle& style); | |
119 | |
120 // Formats a URL for display to the user. Strips out prefixes like whitespace, | |
121 // "http://" and "www." unless the user input (|query_|) matches the prefix. | |
122 // Also removes trailing whitespaces and "/" unless the user input matches the | |
123 // trailing "/". | |
124 void FormatURLForDisplay(string16* url) const; | |
125 | |
126 // Returns true if the Instant page should use iframes to display suggestions. | |
127 static bool ShouldUseIframes(); | |
128 | |
129 private: | 112 private: |
130 // Overridden from content::RenderViewObserver: | 113 // Overridden from content::RenderViewObserver: |
131 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 114 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
132 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; | 115 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; |
133 | 116 |
134 void OnChange(const string16& query, | 117 void OnChange(const string16& query, |
135 bool verbatim, | 118 bool verbatim, |
136 size_t selection_start, | 119 size_t selection_start, |
137 size_t selection_end); | 120 size_t selection_end); |
138 void OnSubmit(const string16& query); | 121 void OnSubmit(const string16& query); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 int start_margin_; | 153 int start_margin_; |
171 gfx::Rect popup_bounds_; | 154 gfx::Rect popup_bounds_; |
172 bool is_key_capture_enabled_; | 155 bool is_key_capture_enabled_; |
173 ThemeBackgroundInfo theme_info_; | 156 ThemeBackgroundInfo theme_info_; |
174 bool display_instant_results_; | 157 bool display_instant_results_; |
175 string16 omnibox_font_; | 158 string16 omnibox_font_; |
176 size_t omnibox_font_size_; | 159 size_t omnibox_font_size_; |
177 InstantRestrictedIDCache<InstantAutocompleteResult> | 160 InstantRestrictedIDCache<InstantAutocompleteResult> |
178 autocomplete_results_cache_; | 161 autocomplete_results_cache_; |
179 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; | 162 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; |
180 InstantAutocompleteResultStyle autocomplete_results_style_; | |
181 | 163 |
182 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 164 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
183 }; | 165 }; |
184 | 166 |
185 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 167 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |