Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: chrome/browser/instant/instant_controller.h

Issue 11824050: InstantExtended: Committed NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_INSTANT_INSTANT_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 6 #define CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "base/timer.h" 17 #include "base/timer.h"
18 #include "chrome/browser/instant/instant_commit_type.h" 18 #include "chrome/browser/instant/instant_commit_type.h"
19 #include "chrome/browser/instant/instant_model.h" 19 #include "chrome/browser/instant/instant_model.h"
20 #include "chrome/browser/instant/instant_page.h"
20 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 21 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
21 #include "chrome/common/instant_types.h" 22 #include "chrome/common/instant_types.h"
22 #include "chrome/common/search_types.h" 23 #include "chrome/common/search_types.h"
23 #include "content/public/common/page_transition_types.h" 24 #include "content/public/common/page_transition_types.h"
24 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
25 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
26 #include "ui/gfx/rect.h" 27 #include "ui/gfx/rect.h"
27 28
28 struct AutocompleteMatch; 29 struct AutocompleteMatch;
29 class AutocompleteProvider; 30 class AutocompleteProvider;
30 class InstantLoader; 31 class InstantNTP;
32 class InstantOverlay;
31 class InstantTab; 33 class InstantTab;
32 class TemplateURL; 34 class TemplateURL;
33 35
34 namespace chrome { 36 namespace chrome {
35 class BrowserInstantController; 37 class BrowserInstantController;
36 } 38 }
37 39
38 namespace content { 40 namespace content {
39 class WebContents; 41 class WebContents;
40 } 42 }
41 43
42 // InstantController maintains a WebContents that is intended to give a preview 44 // InstantController drives Chrome Instant, i.e., the browser implementation of
43 // of search suggestions and results. InstantController is owned by Browser via 45 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch). It
44 // BrowserInstantController. 46 // maintains a WebContents used to show search suggestions and results in an
45 class InstantController { 47 // overlay and a WebContents used for the New Tab Page. InstantController is
48 // owned by Browser via BrowserInstantController.
49 class InstantController : public InstantPage::Delegate {
dhollowa 2013/01/22 22:34:58 I'm a bit confused here... The controller is a pa
samarth 2013/01/25 21:08:40 It's responding (potentially) to all three. That'
46 public: 50 public:
47 // The URL for the local omnibox popup. 51 // The URL for the local omnibox popup.
48 static const char* kLocalOmniboxPopupURL; 52 static const char* kLocalOmniboxPopupURL;
49 53
50 // |use_local_preview_only| will force the use of kLocalOmniboxPopupURL as the 54 // |use_local_preview_only| will force the use of kLocalOmniboxPopupURL as the
51 // instant URL and is only applicable if |extended_enabled| is true. 55 // instant URL and is only applicable if |extended_enabled| is true.
52 InstantController(chrome::BrowserInstantController* browser, 56 InstantController(chrome::BrowserInstantController* browser,
53 bool extended_enabled, 57 bool extended_enabled,
54 bool use_local_preview_only); 58 bool use_local_preview_only);
55 ~InstantController(); 59 ~InstantController();
56 60
57 // Invoked as the user types into the omnibox. |user_text| is what the user 61 // Invoked as the user types into the omnibox. |user_text| is what the user
58 // has typed. |full_text| is what the omnibox is showing. These may differ if 62 // has typed. |full_text| is what the omnibox is showing. These may differ if
59 // the user typed only some text, and the rest was inline autocompleted. If 63 // the user typed only some text, and the rest was inline autocompleted. If
60 // |verbatim| is true, search results are shown for the exact omnibox text, 64 // |verbatim| is true, search results are shown for the exact omnibox text,
61 // rather than the best guess as to what the user means. Returns true if the 65 // rather than the best guess as to what the user means. Returns true if the
62 // update is accepted (i.e., if |match| is a search rather than a URL). 66 // update is accepted (i.e., if |match| is a search rather than a URL).
63 // |is_keyword_search| is true if keyword searching is in effect. 67 // |is_keyword_search| is true if keyword searching is in effect.
64 bool Update(const AutocompleteMatch& match, 68 bool Update(const AutocompleteMatch& match,
65 const string16& user_text, 69 const string16& user_text,
66 const string16& full_text, 70 const string16& full_text,
67 size_t selection_start, 71 size_t selection_start,
68 size_t selection_end, 72 size_t selection_end,
69 bool verbatim, 73 bool verbatim,
70 bool user_input_in_progress, 74 bool user_input_in_progress,
71 bool omnibox_popup_is_open, 75 bool omnibox_popup_is_open,
72 bool escape_pressed, 76 bool escape_pressed,
73 bool is_keyword_search); 77 bool is_keyword_search);
74 78
79 // Releases and returns the NTP WebContents. May be NULL. Loads a new
80 // WebContents for the NTP.
81 content::WebContents* ReleaseNTPContents();
dhollowa 2013/01/22 22:34:58 This should use scoped_ptr<contents::WebContents>
samarth 2013/01/25 21:08:40 Ah, didn't know about this. This is really nice,
82
75 // Sets the bounds of the omnibox popup, in screen coordinates. 83 // Sets the bounds of the omnibox popup, in screen coordinates.
76 void SetPopupBounds(const gfx::Rect& bounds); 84 void SetPopupBounds(const gfx::Rect& bounds);
77 85
78 // Sets the start and end margins of the omnibox text area. 86 // Sets the start and end margins of the omnibox text area.
79 void SetMarginSize(int start, int end); 87 void SetMarginSize(int start, int end);
80 88
81 // Send autocomplete results from |providers| to the preview page. 89 // Send autocomplete results from |providers| to the preview page.
82 void HandleAutocompleteResults( 90 void HandleAutocompleteResults(
83 const std::vector<AutocompleteProvider*>& providers); 91 const std::vector<AutocompleteProvider*>& providers);
84 92
(...skipping 13 matching lines...) Expand all
98 bool CommitIfPossible(InstantCommitType type); 106 bool CommitIfPossible(InstantCommitType type);
99 107
100 // Called to indicate that the omnibox focus state changed with the given 108 // Called to indicate that the omnibox focus state changed with the given
101 // |reason|. If |focus_state| is FOCUS_NONE, |view_gaining_focus| is set to 109 // |reason|. If |focus_state| is FOCUS_NONE, |view_gaining_focus| is set to
102 // the view gaining focus. 110 // the view gaining focus.
103 void OmniboxFocusChanged(OmniboxFocusState focus_state, 111 void OmniboxFocusChanged(OmniboxFocusState focus_state,
104 OmniboxFocusChangeReason reason, 112 OmniboxFocusChangeReason reason,
105 gfx::NativeView view_gaining_focus); 113 gfx::NativeView view_gaining_focus);
106 114
107 // The search mode in the active tab has changed. Pass the message down to 115 // The search mode in the active tab has changed. Pass the message down to
108 // the loader which will notify the renderer. Create |instant_tab_| if the 116 // the overlay which will notify the renderer. Create |instant_tab_| if the
109 // |new_mode| reflects an Instant search results page. 117 // |new_mode| reflects an Instant search results page.
110 void SearchModeChanged(const chrome::search::Mode& old_mode, 118 void SearchModeChanged(const chrome::search::Mode& old_mode,
111 const chrome::search::Mode& new_mode); 119 const chrome::search::Mode& new_mode);
112 120
113 // The user switched tabs. Hide the preview. Create |instant_tab_| if the 121 // The user switched tabs. Hide the preview. Create |instant_tab_| if the
114 // newly active tab is an Instant search results page. 122 // newly active tab is an Instant search results page.
115 void ActiveTabChanged(); 123 void ActiveTabChanged();
116 124
117 // The user is about to switch tabs. Commit the preview if needed. 125 // The user is about to switch tabs. Commit the preview if needed.
118 void TabDeactivated(content::WebContents* contents); 126 void TabDeactivated(content::WebContents* contents);
119 127
120 // Sets whether Instant should show result previews. 128 // Sets whether Instant should show result previews.
121 void SetInstantEnabled(bool instant_enabled); 129 void SetInstantEnabled(bool instant_enabled);
122 130
123 // The theme has changed. Pass the message to the preview page. 131 // The theme has changed. Pass the message to the preview page.
124 void ThemeChanged(const ThemeBackgroundInfo& theme_info); 132 void ThemeChanged(const ThemeBackgroundInfo& theme_info);
125 133
126 // The theme area height has changed. Pass the message to the preview page. 134 // The theme area height has changed. Pass the message to the preview page.
127 void ThemeAreaHeightChanged(int height); 135 void ThemeAreaHeightChanged(int height);
128 136
129 // Returns the transition type of the last AutocompleteMatch passed to Update. 137 // Returns the transition type of the last AutocompleteMatch passed to Update.
130 content::PageTransition last_transition_type() const { 138 content::PageTransition last_transition_type() const {
131 return last_transition_type_; 139 return last_transition_type_;
132 } 140 }
133 141
134 const InstantModel* model() const { return &model_; } 142 const InstantModel* model() const { return &model_; }
135 143
136 // Invoked by the page when it has suggested text.
137 void SetSuggestions(const content::WebContents* contents,
138 const std::vector<InstantSuggestion>& suggestions);
139
140 // Invoked by the page when its support for the Instant API is determined.
141 void InstantSupportDetermined(const content::WebContents* contents,
142 bool supports_instant);
143
144 // Invoked by InstantLoader to request that the preview be shown.
145 void ShowInstantPreview(InstantShownReason reason,
146 int height,
147 InstantSizeUnits units);
148
149 // Invoked by InstantLoader to request the browser to start capturing user key
150 // strokes.
151 void StartCapturingKeyStrokes();
152
153 // Invoked by InstantLoader to request the browser to stop capturing user key
154 // strokes.
155 void StopCapturingKeyStrokes();
156
157 // Invoked by InstantLoader when it has swapped a different WebContents into
158 // the preview, usually because a prerendered page was navigated to.
159 void SwappedWebContents();
160
161 // Invoked by InstantLoader when the preview gains focus, usually due to the
162 // user clicking on it.
163 void InstantLoaderContentsFocused();
164
165 // Invoked by the InstantLoader when its RenderView crashes.
166 void InstantLoaderRenderViewGone();
167
168 // Invoked by InstantLoader when the instant page is about to navigate.
169 void InstantLoaderAboutToNavigateMainFrame(const GURL& url);
170
171 // Invoked by the InstantLoader when the instant page wants to navigate to
172 // the speicfied URL.
173 void NavigateToURL(const GURL& url, content::PageTransition transition);
174
175 private: 144 private:
176 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); 145 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant);
177 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL); 146 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL);
178 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); 147 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider);
179 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh); 148 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh);
180 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); 149 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn);
181 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant); 150 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant);
182 151
152 // Overridden from InstantPage::Delegate
dhollowa 2013/01/22 22:34:58 nit: Should end with ":".
samarth 2013/01/25 21:08:40 Done.
153 virtual void InstantSupportDetermined(
154 const content::WebContents* contents,
155 bool supports_instant) OVERRIDE;
156 virtual void InstantPageRenderViewGone(
157 const content::WebContents* contents) OVERRIDE;
158 virtual void InstantPageAboutToNavigateMainFrame(
159 const content::WebContents* contents,
160 const GURL& url) OVERRIDE;
161 virtual void SetSuggestions(
162 const content::WebContents* contents,
163 const std::vector<InstantSuggestion>& suggestions) OVERRIDE;
164 virtual void ShowInstantPreview(
165 const content::WebContents* contents,
166 InstantShownReason reason,
167 int height,
168 InstantSizeUnits units) OVERRIDE;
169 virtual void StartCapturingKeyStrokes(
170 const content::WebContents* contents) OVERRIDE;
171 virtual void StopCapturingKeyStrokes(content::WebContents* contents) OVERRIDE;
172 virtual void NavigateToURL(
173 const content::WebContents* contents,
174 const GURL& url,
175 content::PageTransition transition) OVERRIDE;
176 virtual void OnStalePage(const content::WebContents* contents) OVERRIDE;
dhollowa 2013/01/22 22:34:58 nit: Shouldn't begin with "On".
samarth 2013/01/25 21:08:40 Done.
177 virtual void InstantPageSwappedContents(
178 content::WebContents* new_contents) OVERRIDE;
179 virtual void InstantPageFocused(
180 const content::WebContents* contents) OVERRIDE;
181 virtual void InstantPageClicked(
182 const content::WebContents* contents) OVERRIDE;
183 virtual bool InstantPageAboutToOpenURL(
184 const content::WebContents* contents) OVERRIDE;
185
183 // Helper for OmniboxFocusChanged. Commit or discard the preview. 186 // Helper for OmniboxFocusChanged. Commit or discard the preview.
184 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); 187 void OmniboxLostFocus(gfx::NativeView view_gaining_focus);
185 188
186 // Creates a new loader if necessary, using the instant_url property of the 189 // Called when the |overlay_| might be stale. If it's actually stale, and the
190 // omnibox doesn't have focus, and the preview isn't showing, the |overlay_|
191 // is deleted and recreated. Else the refresh is skipped.
192 void OnStaleOverlay();
dhollowa 2013/01/22 22:34:58 nit: Shouldn't begin with "On".
samarth 2013/01/25 21:08:40 Done.
193
194 // Creates a new NTP, using the instant_url property of the |template_url|.
195 bool ResetNTP();
196
197 // Creates a new overlay if necessary, using the instant_url property of the
187 // |template_url| (for example, if the Instant URL has changed since the last 198 // |template_url| (for example, if the Instant URL has changed since the last
188 // time the loader was created). If |fallback_to_local| is true will use 199 // time the overlay was created). If |fallback_to_local| is true will use
189 // kLocalOmniboxPopupURL as the fallback url (in extended mode) in case 200 // kLocalOmniboxPopupURL as the fallback url (in extended mode) in case
190 // the |template_url| doesn't have a valid Instant URL. Returns true if an 201 // the |template_url| doesn't have a valid Instant URL. Returns true if an
191 // instant URL could be determined. 202 // instant URL could be determined.
192 bool ResetLoader(const TemplateURL* template_url, 203 bool ResetOverlay(const TemplateURL* template_url,
193 const content::WebContents* active_tab, 204 const content::WebContents* active_tab,
194 bool fallback_to_local); 205 bool fallback_to_local);
195 206
196 // Ensures that the |loader_| uses the default Instant URL, recreating it if 207 // Ensures that the |overlay_| uses the default Instant URL, recreating it if
197 // necessary, and returns true. Returns false if the Instant URL could not be 208 // necessary, and returns true. Returns false if the Instant URL could not be
198 // determined or the active tab is NULL (browser is shutting down). 209 // determined or the active tab is NULL (browser is shutting down).
199 bool CreateDefaultLoader(); 210 bool CreateDefaultOverlay();
200 211
201 // Called when the |loader_| might be stale. If it's actually stale, and the 212 // Called by Update() to ensure we have an Instant page that can process
202 // omnibox doesn't have focus, and the preview isn't showing, the |loader_| is 213 // |match|. Returns true if we should continue with the Update().
203 // deleted and recreated. Else the refresh is skipped. 214 bool ResetOverlayForMatch(const AutocompleteMatch& match);
204 void OnStaleLoader();
205 215
206 // If the active tab is an Instant search results page, sets |instant_tab_| to 216 // If the active tab is an Instant search results page, sets |instant_tab_| to
207 // point to it. Else, deletes any existing |instant_tab_|. 217 // point to it. Else, deletes any existing |instant_tab_|.
208 void ResetInstantTab(); 218 void ResetInstantTab();
209 219
210 // Called by Update() to ensure we have an Instant page that can process
211 // |match|. Returns true if we should continue with the Update().
212 bool ResetLoaderForMatch(const AutocompleteMatch& match);
213
214 // Hide the preview. Also sends an onchange event (with blank query) to the 220 // Hide the preview. Also sends an onchange event (with blank query) to the
215 // preview, telling it to clear out results for any old queries. 221 // preview, telling it to clear out results for any old queries.
216 void HideLoader(); 222 void HideOverlay();
217 223
218 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() 224 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay()
219 // unless you are going to call loader_.reset() yourself subsequently. 225 // unless you are going to call overlay_.reset() yourself subsequently.
220 void HideInternal(); 226 void HideInternal();
221 227
222 // Counterpart to HideLoader(). Asks the |browser_| to display the preview 228 // Counterpart to HideOverlay(). Asks the |browser_| to display the preview
223 // with the given |height|. 229 // with the given |height|.
dhollowa 2013/01/22 22:34:58 nit: "...with the given |height| and |units|."
samarth 2013/01/25 21:08:40 Done.
224 void ShowLoader(InstantShownReason reason, 230 void ShowOverlay(InstantShownReason reason,
225 int height, 231 int height,
226 InstantSizeUnits units); 232 InstantSizeUnits units);
227 233
228 // Send the omnibox popup bounds to the page. 234 // Send the omnibox popup bounds to the page.
229 void SendPopupBoundsToPage(); 235 void SendPopupBoundsToPage();
230 236
231 // If |template_url| is a valid TemplateURL for use with Instant, fills in 237 // If |template_url| is a valid TemplateURL for use with Instant, fills in
232 // |instant_url| and returns true; returns false otherwise. 238 // |instant_url| and returns true; returns false otherwise.
233 // Note: If the command-line switch kInstantURL is set, this method uses its 239 // Note: If the command-line switch kInstantURL is set, this method uses its
234 // value for |instant_url| and returns true without examining |template_url|. 240 // value for |instant_url| and returns true without examining |template_url|.
235 bool GetInstantURL(const TemplateURL* template_url, 241 bool GetInstantURL(const TemplateURL* template_url,
236 std::string* instant_url) const; 242 std::string* instant_url) const;
237 243
244 // Add |url| to the blacklist.
245 void AddToBlacklist(const std::string& url);
246
247 // Remove |url| from the blacklist.
248 void RemoveFromBlacklist(const std::string& url);
249
238 chrome::BrowserInstantController* const browser_; 250 chrome::BrowserInstantController* const browser_;
239 251
240 // Whether the extended API and regular API are enabled. If both are false, 252 // Whether the extended API and regular API are enabled. If both are false,
241 // Instant is effectively disabled. 253 // Instant is effectively disabled.
242 const bool extended_enabled_; 254 const bool extended_enabled_;
243 bool instant_enabled_; 255 bool instant_enabled_;
244 256
245 // If true, the instant URL is set to kLocalOmniboxPopupURL. 257 // If true, the instant URL is set to kLocalOmniboxPopupURL.
246 const bool use_local_preview_only_; 258 const bool use_local_preview_only_;
247 259
248 // The state of the preview page, i.e., the page owned by |loader_|. Ignored 260 // The state of the preview page, i.e., the page owned by |overlay_|. Ignored
249 // if |instant_tab_| is in use. 261 // if |instant_tab_| is in use.
250 InstantModel model_; 262 InstantModel model_;
251 263
252 // The preview WebContents. 264 // WebContents used to show search suggestions and results in an overlay.
253 scoped_ptr<InstantLoader> loader_; 265 scoped_ptr<InstantOverlay> overlay_;
dhollowa 2013/01/22 22:34:58 It would be helpful to articulate the invariants b
samarth 2013/01/25 21:08:40 Done.
254 266
255 // A committed WebContents that supports Instant. If non-NULL, the |loader_| 267 // WebContents used for New Tab Pages.
256 // is guaranteed to be hidden and messages will be sent to this instead. 268 scoped_ptr<InstantNTP> ntp_;
269
270 // A committed WebContents that supports the SearchBoxAPI. If non-NULL, the
271 // |overlay_| is guaranteed to be hidden and messages will be sent to this
272 // instead.
257 scoped_ptr<InstantTab> instant_tab_; 273 scoped_ptr<InstantTab> instant_tab_;
258 274
259 // The most recent full_text passed to Update(). If empty, we'll not accept 275 // The most recent full_text passed to Update(). If empty, we'll not accept
260 // search suggestions from |loader_| or |instant_tab_|. 276 // search suggestions from |overlay_| or |instant_tab_|.
261 string16 last_omnibox_text_; 277 string16 last_omnibox_text_;
262 278
263 // True if the last Update() had an inline autocompletion. Used only to make 279 // True if the last Update() had an inline autocompletion. Used only to make
264 // sure that we don't accidentally suggest gray text suggestion in that case. 280 // sure that we don't accidentally suggest gray text suggestion in that case.
265 bool last_omnibox_text_has_inline_autocompletion_; 281 bool last_omnibox_text_has_inline_autocompletion_;
266 282
267 // The most recent verbatim passed to Update(). Used only to ensure that we 283 // The most recent verbatim passed to Update(). Used only to ensure that we
268 // don't accidentally suggest an inline autocompletion. 284 // don't accidentally suggest an inline autocompletion.
269 bool last_verbatim_; 285 bool last_verbatim_;
270 286
(...skipping 22 matching lines...) Expand all
293 309
294 // Size of the start-edge omnibox text area margin. 310 // Size of the start-edge omnibox text area margin.
295 int start_margin_; 311 int start_margin_;
296 312
297 // Size of the end-edge omnibox text area margin. 313 // Size of the end-edge omnibox text area margin.
298 int end_margin_; 314 int end_margin_;
299 315
300 // Timer used to update the bounds of the omnibox popup. 316 // Timer used to update the bounds of the omnibox popup.
301 base::OneShotTimer<InstantController> update_bounds_timer_; 317 base::OneShotTimer<InstantController> update_bounds_timer_;
302 318
303 // Timer used to ensure that the Instant page does not get too stale.
304 base::OneShotTimer<InstantController> stale_loader_timer_;
305
306 // For each key K => value N, the map says that we found that the search 319 // For each key K => value N, the map says that we found that the search
307 // engine identified by Instant URL K didn't support the Instant API, or 320 // engine identified by Instant URL K didn't support the Instant API, or
308 // caused RenderView crashes in each of the last N times that we loaded it. 321 // caused RenderView crashes in each of the last N times that we loaded it.
309 // If an Instant URL isn't present in the map at all or has a value 0, 322 // If an Instant URL isn't present in the map at all or has a value 0,
310 // it means that search engine supports the Instant API (or we assume it does, 323 // it means that search engine supports the Instant API (or we assume it does,
311 // since we haven't determined it doesn't) and it did not cause a crash. 324 // since we haven't determined it doesn't) and it did not cause a crash.
312 std::map<std::string, int> blacklisted_urls_; 325 std::map<std::string, int> blacklisted_urls_;
313 326
314 // Search terms extraction (for autocomplete history matches) doesn't work 327 // Search terms extraction (for autocomplete history matches) doesn't work
315 // on Instant URLs. So, whenever the user commits an Instant search, we add 328 // on Instant URLs. So, whenever the user commits an Instant search, we add
316 // an equivalent non-Instant search URL to history, so that the search shows 329 // an equivalent non-Instant search URL to history, so that the search shows
317 // up in autocomplete history matches. 330 // up in autocomplete history matches.
318 // TODO(sreeram): Remove when http://crbug.com/155373 is fixed. 331 // TODO(sreeram): Remove when http://crbug.com/155373 is fixed.
319 GURL url_for_history_; 332 GURL url_for_history_;
320 333
321 // The timestamp at which query editing began. This value is used when the 334 // The timestamp at which query editing began. This value is used when the
322 // preview is showed and cleared when the preview is hidden. 335 // preview is showed and cleared when the preview is hidden.
323 base::Time first_interaction_time_; 336 base::Time first_interaction_time_;
324 337
325 // Whether to allow the preview to show search suggestions. In general, the 338 // Whether to allow the preview to show search suggestions. In general, the
326 // preview is allowed to show search suggestions whenever |search_mode_| is 339 // preview is allowed to show search suggestions whenever |search_mode_| is
327 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. 340 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false.
328 bool allow_preview_to_show_search_suggestions_; 341 bool allow_preview_to_show_search_suggestions_;
329 342
330 DISALLOW_COPY_AND_ASSIGN(InstantController); 343 DISALLOW_COPY_AND_ASSIGN(InstantController);
331 }; 344 };
332 345
333 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 346 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698