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 28 matching lines...) Expand all Loading... |
167 int start_margin_; | 150 int start_margin_; |
168 gfx::Rect popup_bounds_; | 151 gfx::Rect popup_bounds_; |
169 bool is_key_capture_enabled_; | 152 bool is_key_capture_enabled_; |
170 ThemeBackgroundInfo theme_info_; | 153 ThemeBackgroundInfo theme_info_; |
171 bool display_instant_results_; | 154 bool display_instant_results_; |
172 string16 omnibox_font_; | 155 string16 omnibox_font_; |
173 size_t omnibox_font_size_; | 156 size_t omnibox_font_size_; |
174 InstantRestrictedIDCache<InstantAutocompleteResult> | 157 InstantRestrictedIDCache<InstantAutocompleteResult> |
175 autocomplete_results_cache_; | 158 autocomplete_results_cache_; |
176 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; | 159 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; |
177 InstantAutocompleteResultStyle autocomplete_results_style_; | |
178 | 160 |
179 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 161 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
180 }; | 162 }; |
181 | 163 |
182 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 164 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |