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

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: Address comments. Created 7 years, 10 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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/string16.h" 17 #include "base/string16.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "base/timer.h" 19 #include "base/timer.h"
20 #include "chrome/browser/instant/instant_commit_type.h" 20 #include "chrome/browser/instant/instant_commit_type.h"
21 #include "chrome/browser/instant/instant_model.h" 21 #include "chrome/browser/instant/instant_model.h"
22 #include "chrome/browser/instant/instant_page.h"
22 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 23 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
23 #include "chrome/common/instant_types.h" 24 #include "chrome/common/instant_types.h"
24 #include "chrome/common/search_types.h" 25 #include "chrome/common/search_types.h"
25 #include "content/public/common/page_transition_types.h" 26 #include "content/public/common/page_transition_types.h"
26 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
27 #include "ui/gfx/native_widget_types.h" 28 #include "ui/gfx/native_widget_types.h"
28 #include "ui/gfx/rect.h" 29 #include "ui/gfx/rect.h"
29 30
30 struct AutocompleteMatch; 31 struct AutocompleteMatch;
31 class AutocompleteProvider; 32 class AutocompleteProvider;
32 class InstantLoader; 33 class InstantNTP;
34 class InstantOverlay;
33 class InstantTab; 35 class InstantTab;
34 class TemplateURL; 36 class TemplateURL;
35 37
36 namespace chrome { 38 namespace chrome {
37 class BrowserInstantController; 39 class BrowserInstantController;
38 } 40 }
39 41
40 namespace content { 42 namespace content {
41 class WebContents; 43 class WebContents;
42 } 44 }
43 45
44 // Macro used for logging debug events. |message| should be a std::string. 46 // Macro used for logging debug events. |message| should be a std::string.
45 #define LOG_INSTANT_DEBUG_EVENT(controller, message) \ 47 #define LOG_INSTANT_DEBUG_EVENT(controller, message) \
46 controller->LogDebugEvent(message) 48 controller->LogDebugEvent(message)
47 49
48 // InstantController maintains a WebContents that is intended to give a preview 50 // InstantController drives Chrome Instant, i.e., the browser implementation of
49 // of search suggestions and results. InstantController is owned by Browser via 51 // the Embedded Search API (see http://dev.chromium.org/embeddedsearch).
50 // BrowserInstantController. 52 //
51 class InstantController { 53 // In extended mode, InstantController maintains and coordinates three
54 // instances of InstantPage:
55 // (1) An InstantOverlay instance that is used to show search suggestions and
56 // results in an overlay over a non-search page.
57 // (2) An InstantNTP instance which is a preloaded sarch page that will be
58 // swapped-in the next time the user navigates to the New Tab Page. It is
59 // never shown to the user in an uncommitted state.
60 // (3) An InstantTab instance which points to the currently active tab, if it
61 // supports the Embedded Search API.
62 //
63 // All three are backed by a WebContents. InstantOverlay and InstantNTP own
64 // their corresponding WebContents; InstantTab does not. In non-extended mode,
65 // only an InstantOverlay instance is kept.
66 //
67 // InstantController is owned by Browser via BrowserInstantController.
68 class InstantController : public InstantPage::Delegate {
52 public: 69 public:
53 // The URL for the local omnibox popup. 70 // The URL for the local omnibox popup.
54 static const char* kLocalOmniboxPopupURL; 71 static const char* kLocalOmniboxPopupURL;
55 72
56 // |use_local_preview_only| will force the use of kLocalOmniboxPopupURL as the 73 // |use_local_preview_only| will force the use of kLocalOmniboxPopupURL as the
57 // instant URL and is only applicable if |extended_enabled| is true. 74 // instant URL and is only applicable if |extended_enabled| is true.
58 InstantController(chrome::BrowserInstantController* browser, 75 InstantController(chrome::BrowserInstantController* browser,
59 bool extended_enabled, 76 bool extended_enabled,
60 bool use_local_preview_only); 77 bool use_local_preview_only);
61 ~InstantController(); 78 ~InstantController();
62 79
63 // Invoked as the user types into the omnibox. |user_text| is what the user 80 // Invoked as the user types into the omnibox. |user_text| is what the user
64 // has typed. |full_text| is what the omnibox is showing. These may differ if 81 // has typed. |full_text| is what the omnibox is showing. These may differ if
65 // the user typed only some text, and the rest was inline autocompleted. If 82 // the user typed only some text, and the rest was inline autocompleted. If
66 // |verbatim| is true, search results are shown for the exact omnibox text, 83 // |verbatim| is true, search results are shown for the exact omnibox text,
67 // rather than the best guess as to what the user means. Returns true if the 84 // rather than the best guess as to what the user means. Returns true if the
68 // update is accepted (i.e., if |match| is a search rather than a URL). 85 // update is accepted (i.e., if |match| is a search rather than a URL).
69 // |is_keyword_search| is true if keyword searching is in effect. 86 // |is_keyword_search| is true if keyword searching is in effect.
70 bool Update(const AutocompleteMatch& match, 87 bool Update(const AutocompleteMatch& match,
71 const string16& user_text, 88 const string16& user_text,
72 const string16& full_text, 89 const string16& full_text,
73 size_t selection_start, 90 size_t selection_start,
74 size_t selection_end, 91 size_t selection_end,
75 bool verbatim, 92 bool verbatim,
76 bool user_input_in_progress, 93 bool user_input_in_progress,
77 bool omnibox_popup_is_open, 94 bool omnibox_popup_is_open,
78 bool escape_pressed, 95 bool escape_pressed,
79 bool is_keyword_search); 96 bool is_keyword_search);
80 97
98 // Releases and returns the NTP WebContents. May be NULL. Loads a new
99 // WebContents for the NTP.
100 scoped_ptr<content::WebContents> ReleaseNTPContents() WARN_UNUSED_RESULT;
101
81 // Sets the bounds of the omnibox popup, in screen coordinates. 102 // Sets the bounds of the omnibox popup, in screen coordinates.
82 void SetPopupBounds(const gfx::Rect& bounds); 103 void SetPopupBounds(const gfx::Rect& bounds);
83 104
84 // Sets the start and end margins of the omnibox text area. 105 // Sets the start and end margins of the omnibox text area.
85 void SetMarginSize(int start, int end); 106 void SetMarginSize(int start, int end);
86 107
87 // Send autocomplete results from |providers| to the preview page. 108 // Send autocomplete results from |providers| to the preview page.
88 void HandleAutocompleteResults( 109 void HandleAutocompleteResults(
89 const std::vector<AutocompleteProvider*>& providers); 110 const std::vector<AutocompleteProvider*>& providers);
90 111
(...skipping 13 matching lines...) Expand all
104 bool CommitIfPossible(InstantCommitType type); 125 bool CommitIfPossible(InstantCommitType type);
105 126
106 // Called to indicate that the omnibox focus state changed with the given 127 // Called to indicate that the omnibox focus state changed with the given
107 // |reason|. If |focus_state| is FOCUS_NONE, |view_gaining_focus| is set to 128 // |reason|. If |focus_state| is FOCUS_NONE, |view_gaining_focus| is set to
108 // the view gaining focus. 129 // the view gaining focus.
109 void OmniboxFocusChanged(OmniboxFocusState focus_state, 130 void OmniboxFocusChanged(OmniboxFocusState focus_state,
110 OmniboxFocusChangeReason reason, 131 OmniboxFocusChangeReason reason,
111 gfx::NativeView view_gaining_focus); 132 gfx::NativeView view_gaining_focus);
112 133
113 // The search mode in the active tab has changed. Pass the message down to 134 // The search mode in the active tab has changed. Pass the message down to
114 // the loader which will notify the renderer. Create |instant_tab_| if the 135 // the overlay which will notify the renderer. Create |instant_tab_| if the
115 // |new_mode| reflects an Instant search results page. 136 // |new_mode| reflects an Instant search results page.
116 void SearchModeChanged(const chrome::search::Mode& old_mode, 137 void SearchModeChanged(const chrome::search::Mode& old_mode,
117 const chrome::search::Mode& new_mode); 138 const chrome::search::Mode& new_mode);
118 139
119 // The user switched tabs. Hide the preview. Create |instant_tab_| if the 140 // The user switched tabs. Hide the preview. Create |instant_tab_| if the
120 // newly active tab is an Instant search results page. 141 // newly active tab is an Instant search results page.
121 void ActiveTabChanged(); 142 void ActiveTabChanged();
122 143
123 // The user is about to switch tabs. Commit the preview if needed. 144 // The user is about to switch tabs. Commit the preview if needed.
124 void TabDeactivated(content::WebContents* contents); 145 void TabDeactivated(content::WebContents* contents);
125 146
126 // Sets whether Instant should show result previews. 147 // Sets whether Instant should show result previews.
127 void SetInstantEnabled(bool instant_enabled); 148 void SetInstantEnabled(bool instant_enabled);
128 149
129 // The theme has changed. Pass the message to the preview page. 150 // The theme has changed. Pass the message to the preview page.
130 void ThemeChanged(const ThemeBackgroundInfo& theme_info); 151 void ThemeChanged(const ThemeBackgroundInfo& theme_info);
131 152
132 // The theme area height has changed. Pass the message to the preview page. 153 // The theme area height has changed. Pass the message to the preview page.
133 void ThemeAreaHeightChanged(int height); 154 void ThemeAreaHeightChanged(int height);
134 155
135 // Returns the transition type of the last AutocompleteMatch passed to Update. 156 // Called when someone else swapped in a different contents in the |overlay_|.
136 content::PageTransition last_transition_type() const { 157 void SwappedOverlayContents();
137 return last_transition_type_;
138 }
139 158
140 const InstantModel* model() const { return &model_; } 159 // Called when contents for |overlay_| received focus.
160 void FocusedOverlayContents();
141 161
142 // Invoked by the page when it has suggested text. 162 // Called when the |overlay_| might be stale. If it's actually stale, and the
143 void SetSuggestions(const content::WebContents* contents, 163 // omnibox doesn't have focus, and the preview isn't showing, the |overlay_|
144 const std::vector<InstantSuggestion>& suggestions); 164 // is deleted and recreated. Else the refresh is skipped.
145 165 void ReloadOverlayIfStale();
146 // Invoked by the page when its support for the Instant API is determined.
147 void InstantSupportDetermined(const content::WebContents* contents,
148 bool supports_instant);
149
150 // Invoked by InstantLoader to request that the preview be shown.
151 void ShowInstantPreview(InstantShownReason reason,
152 int height,
153 InstantSizeUnits units);
154
155 // Invoked by InstantLoader to request the browser to start capturing user key
156 // strokes.
157 void StartCapturingKeyStrokes();
158
159 // Invoked by InstantLoader to request the browser to stop capturing user key
160 // strokes.
161 void StopCapturingKeyStrokes();
162
163 // Invoked by InstantLoader when it has swapped a different WebContents into
164 // the preview, usually because a prerendered page was navigated to.
165 void SwappedWebContents();
166
167 // Invoked by InstantLoader when the preview gains focus, usually due to the
168 // user clicking on it.
169 void InstantLoaderContentsFocused();
170
171 // Invoked by the InstantLoader when its RenderView crashes.
172 void InstantLoaderRenderViewGone();
173
174 // Invoked by InstantLoader when the instant page is about to navigate.
175 void InstantLoaderAboutToNavigateMainFrame(const GURL& url);
176
177 // Invoked by the InstantLoader when the instant page wants to navigate to
178 // the speicfied URL.
179 void NavigateToURL(const GURL& url, content::PageTransition transition);
180 166
181 // Adds a new event to |debug_events_| and also DVLOG's it. Ensures that 167 // Adds a new event to |debug_events_| and also DVLOG's it. Ensures that
182 // |debug_events_| doesn't get too large. 168 // |debug_events_| doesn't get too large.
183 void LogDebugEvent(const std::string& info) const; 169 void LogDebugEvent(const std::string& info) const;
184 170
185 // See comments for |debug_events_| below. 171 // See comments for |debug_events_| below.
186 const std::list<std::pair<int64, std::string> >& debug_events() { 172 const std::list<std::pair<int64, std::string> >& debug_events() {
187 return debug_events_; 173 return debug_events_;
188 } 174 }
189 175
176 // Returns the transition type of the last AutocompleteMatch passed to Update.
177 content::PageTransition last_transition_type() const {
178 return last_transition_type_;
179 }
180
181 const InstantModel* model() const { return &model_; }
182
190 private: 183 private:
191 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); 184 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant);
192 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL); 185 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL);
193 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); 186 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider);
194 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh); 187 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefresh);
195 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); 188 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn);
196 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant); 189 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant);
190 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded);
191 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab);
192 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab);
193 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation);
194
195 // Overridden from InstantPage::Delegate:
196 virtual void InstantSupportDetermined(
197 const content::WebContents* contents,
198 bool supports_instant) OVERRIDE;
199 virtual void InstantPageRenderViewGone(
200 const content::WebContents* contents) OVERRIDE;
201 virtual void InstantPageAboutToNavigateMainFrame(
202 const content::WebContents* contents,
203 const GURL& url) OVERRIDE;
204 virtual void SetSuggestions(
205 const content::WebContents* contents,
206 const std::vector<InstantSuggestion>& suggestions) OVERRIDE;
207 virtual void ShowInstantPreview(
208 const content::WebContents* contents,
209 InstantShownReason reason,
210 int height,
211 InstantSizeUnits units) OVERRIDE;
212 virtual void StartCapturingKeyStrokes(
213 const content::WebContents* contents) OVERRIDE;
214 virtual void StopCapturingKeyStrokes(content::WebContents* contents) OVERRIDE;
215 virtual void NavigateToURL(
216 const content::WebContents* contents,
217 const GURL& url,
218 content::PageTransition transition) OVERRIDE;
197 219
198 // Helper for OmniboxFocusChanged. Commit or discard the preview. 220 // Helper for OmniboxFocusChanged. Commit or discard the preview.
199 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); 221 void OmniboxLostFocus(gfx::NativeView view_gaining_focus);
200 222
201 // Ensures that |loader_| uses the Instant URL returned by GetInstantURL(), 223 // Creates a new NTP, using the instant_url property of the default
202 // creating a new loader if necessary. In extended mode, will fallback to 224 // TemplateURL.
225 void ResetNTP();
226
227 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(),
228 // creating a new overlay if necessary. In extended mode, will fallback to
203 // using the kLocalOmniboxPopupURL as the Instant URL in case GetInstantURL() 229 // using the kLocalOmniboxPopupURL as the Instant URL in case GetInstantURL()
204 // returns false. Returns true if an Instant URL could be determined. 230 // returns false. Returns true if an Instant URL could be determined.
205 bool EnsureLoaderIsCurrent(); 231 bool EnsureOverlayIsCurrent();
206 232
207 // Recreates the |loader_| with the input |instant_url|. The caller should 233 // Recreates the |overlay_| with |instant_url|. Note that |overlay_| is
208 // ensure that the |loader_| is not already on the stack since it is deleted 234 // deleted in this call.
209 // in this call. 235 void CreateOverlay(const std::string& instant_url,
210 void CreateLoader(const std::string& instant_url, 236 const content::WebContents* active_tab);
211 const content::WebContents* active_tab);
212
213 // Called when the |loader_| might be stale. If it's actually stale, and the
214 // omnibox doesn't have focus, and the preview isn't showing, the |loader_| is
215 // deleted and recreated. Else the refresh is skipped.
216 void OnStaleLoader();
217 237
218 // If the active tab is an Instant search results page, sets |instant_tab_| to 238 // If the active tab is an Instant search results page, sets |instant_tab_| to
219 // point to it. Else, deletes any existing |instant_tab_|. 239 // point to it. Else, deletes any existing |instant_tab_|.
220 void ResetInstantTab(); 240 void ResetInstantTab();
221 241
222 // Hide the preview. Also sends an onchange event (with blank query) to the 242 // Hide the preview. Also sends an onchange event (with blank query) to the
223 // preview, telling it to clear out results for any old queries. 243 // preview, telling it to clear out results for any old queries.
224 void HideLoader(); 244 void HideOverlay();
225 245
226 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() 246 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay()
227 // unless you are going to call loader_.reset() yourself subsequently. 247 // unless you are going to call overlay_.reset() yourself subsequently.
228 void HideInternal(); 248 void HideInternal();
229 249
230 // Counterpart to HideLoader(). Asks the |browser_| to display the preview 250 // Counterpart to HideOverlay(). Asks the |browser_| to display the preview
231 // with the given |height|. 251 // with the given |height| in |units|.
232 void ShowLoader(InstantShownReason reason, 252 void ShowOverlay(InstantShownReason reason,
233 int height, 253 int height,
234 InstantSizeUnits units); 254 InstantSizeUnits units);
235 255
236 // Send the omnibox popup bounds to the page. 256 // Send the omnibox popup bounds to the page.
237 void SendPopupBoundsToPage(); 257 void SendPopupBoundsToPage();
238 258
239 // Determines the Instant URL based on a number of factors: 259 // Determines the Instant URL based on a number of factors:
240 // If |extended_enabled_|: 260 // If |extended_enabled_|:
241 // - If |use_local_preview_only_| is true return kLocalOmniboxPopupURL, else 261 // - If |use_local_preview_only_| is true return kLocalOmniboxPopupURL, else
242 // - If the Instant URL is specified by command line, returns it, else 262 // - If the Instant URL is specified by command line, returns it, else
243 // - If the default Instant URL is present returns it. 263 // - If the default Instant URL is present returns it.
244 // If !|extended_enabled_|: 264 // If !|extended_enabled_|:
245 // - If the Instant URL is specified by command line, returns it, else 265 // - If the Instant URL is specified by command line, returns it, else
246 // - If the default Instant URL is present returns it. 266 // - If the default Instant URL is present returns it.
247 // 267 //
248 // Returns true if a valid Instant URL could be found that is not blacklisted. 268 // Returns true if a valid Instant URL could be found that is not blacklisted.
249 bool GetInstantURL(const content::WebContents* active_tab, 269 bool GetInstantURL(Profile* profile, std::string* instant_url) const;
250 std::string* instant_url) const; 270
271 // Adds the URL for the page to the blacklist. Deletes the contents held and
272 // recreates a new page.
273 void BlacklistAndResetOverlay();
274 void BlacklistAndResetNTP();
275
276 // Removes |url| from the blacklist.
277 void RemoveFromBlacklist(const std::string& url);
278
279 InstantOverlay* overlay() const { return overlay_.get(); }
280 InstantTab* instant_tab() const { return instant_tab_.get(); }
281 InstantNTP* ntp() const { return ntp_.get(); }
251 282
252 chrome::BrowserInstantController* const browser_; 283 chrome::BrowserInstantController* const browser_;
253 284
254 // Whether the extended API and regular API are enabled. If both are false, 285 // Whether the extended API and regular API are enabled. If both are false,
255 // Instant is effectively disabled. 286 // Instant is effectively disabled.
256 const bool extended_enabled_; 287 const bool extended_enabled_;
257 bool instant_enabled_; 288 bool instant_enabled_;
258 289
259 // If true, the instant URL is set to kLocalOmniboxPopupURL. 290 // If true, the instant URL is set to kLocalOmniboxPopupURL.
260 const bool use_local_preview_only_; 291 const bool use_local_preview_only_;
261 292
262 // The state of the preview page, i.e., the page owned by |loader_|. Ignored 293 // The state of the preview page, i.e., the page owned by |overlay_|. Ignored
263 // if |instant_tab_| is in use. 294 // if |instant_tab_| is in use.
264 InstantModel model_; 295 InstantModel model_;
265 296
266 // The preview WebContents. 297 // The three instances of InstantPage maintained by InstantController as
267 scoped_ptr<InstantLoader> loader_; 298 // described above. All three may be non-NULL in extended mode. If
268 299 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and
269 // A committed WebContents that supports Instant. If non-NULL, the |loader_| 300 // messages will be sent to |instant_tab_| instead.
270 // is guaranteed to be hidden and messages will be sent to this instead. 301 //
302 // In non-extended mode, only |overlay_| is ever non-NULL.
303 scoped_ptr<InstantOverlay> overlay_;
304 scoped_ptr<InstantNTP> ntp_;
271 scoped_ptr<InstantTab> instant_tab_; 305 scoped_ptr<InstantTab> instant_tab_;
272 306
273 // The most recent full_text passed to Update(). If empty, we'll not accept 307 // The most recent full_text passed to Update(). If empty, we'll not accept
274 // search suggestions from |loader_| or |instant_tab_|. 308 // search suggestions from |overlay_| or |instant_tab_|.
275 string16 last_omnibox_text_; 309 string16 last_omnibox_text_;
276 310
277 // True if the last Update() had an inline autocompletion. Used only to make 311 // True if the last Update() had an inline autocompletion. Used only to make
278 // sure that we don't accidentally suggest gray text suggestion in that case. 312 // sure that we don't accidentally suggest gray text suggestion in that case.
279 bool last_omnibox_text_has_inline_autocompletion_; 313 bool last_omnibox_text_has_inline_autocompletion_;
280 314
281 // The most recent verbatim passed to Update(). Used only to ensure that we 315 // The most recent verbatim passed to Update(). Used only to ensure that we
282 // don't accidentally suggest an inline autocompletion. 316 // don't accidentally suggest an inline autocompletion.
283 bool last_verbatim_; 317 bool last_verbatim_;
284 318
(...skipping 22 matching lines...) Expand all
307 341
308 // Size of the start-edge omnibox text area margin. 342 // Size of the start-edge omnibox text area margin.
309 int start_margin_; 343 int start_margin_;
310 344
311 // Size of the end-edge omnibox text area margin. 345 // Size of the end-edge omnibox text area margin.
312 int end_margin_; 346 int end_margin_;
313 347
314 // Timer used to update the bounds of the omnibox popup. 348 // Timer used to update the bounds of the omnibox popup.
315 base::OneShotTimer<InstantController> update_bounds_timer_; 349 base::OneShotTimer<InstantController> update_bounds_timer_;
316 350
317 // Timer used to ensure that the Instant page does not get too stale.
318 base::OneShotTimer<InstantController> stale_loader_timer_;
319
320 // For each key K => value N, the map says that we found that the search 351 // For each key K => value N, the map says that we found that the search
321 // engine identified by Instant URL K didn't support the Instant API, or 352 // engine identified by Instant URL K didn't support the Instant API, or
322 // caused RenderView crashes in each of the last N times that we loaded it. 353 // caused RenderView crashes in each of the last N times that we loaded it.
323 // If an Instant URL isn't present in the map at all or has a value 0, 354 // If an Instant URL isn't present in the map at all or has a value 0,
324 // it means that search engine supports the Instant API (or we assume it does, 355 // it means that search engine supports the Instant API (or we assume it does,
325 // since we haven't determined it doesn't) and it did not cause a crash. 356 // since we haven't determined it doesn't) and it did not cause a crash.
326 std::map<std::string, int> blacklisted_urls_; 357 std::map<std::string, int> blacklisted_urls_;
327 358
328 // Search terms extraction (for autocomplete history matches) doesn't work 359 // Search terms extraction (for autocomplete history matches) doesn't work
329 // on Instant URLs. So, whenever the user commits an Instant search, we add 360 // on Instant URLs. So, whenever the user commits an Instant search, we add
(...skipping 11 matching lines...) Expand all
341 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. 372 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false.
342 bool allow_preview_to_show_search_suggestions_; 373 bool allow_preview_to_show_search_suggestions_;
343 374
344 // List of events and their timestamps, useful in debugging Instant behaviour. 375 // List of events and their timestamps, useful in debugging Instant behaviour.
345 mutable std::list<std::pair<int64, std::string> > debug_events_; 376 mutable std::list<std::pair<int64, std::string> > debug_events_;
346 377
347 DISALLOW_COPY_AND_ASSIGN(InstantController); 378 DISALLOW_COPY_AND_ASSIGN(InstantController);
348 }; 379 };
349 380
350 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 381 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698