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

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, 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 // Non-const for Add/RemoveObserver only. Other model changes should only 159 // Called when contents for |overlay_| received focus.
141 // happen through the InstantController interface. 160 void FocusedOverlayContents();
142 InstantModel* model() { return &model_; }
143 161
144 // Invoked by the page when it has suggested text. 162 // Called when the |overlay_| might be stale. If it's actually stale, and the
145 void SetSuggestions(const content::WebContents* contents, 163 // omnibox doesn't have focus, and the preview isn't showing, the |overlay_|
146 const std::vector<InstantSuggestion>& suggestions); 164 // is deleted and recreated. Else the refresh is skipped.
147 165 void ReloadOverlayIfStale();
148 // Invoked by the page when its support for the Instant API is determined.
149 void InstantSupportDetermined(const content::WebContents* contents,
150 bool supports_instant);
151
152 // Invoked by InstantLoader to request that the preview be shown.
153 void ShowInstantPreview(InstantShownReason reason,
154 int height,
155 InstantSizeUnits units);
156
157 // Invoked by InstantLoader to request the browser to start capturing user key
158 // strokes.
159 void StartCapturingKeyStrokes();
160
161 // Invoked by InstantLoader to request the browser to stop capturing user key
162 // strokes.
163 void StopCapturingKeyStrokes();
164
165 // Invoked by InstantLoader when it has swapped a different WebContents into
166 // the preview, usually because a prerendered page was navigated to.
167 void SwappedWebContents();
168
169 // Invoked by InstantLoader when the preview gains focus, usually due to the
170 // user clicking on it.
171 void InstantLoaderContentsFocused();
172
173 // Invoked by the InstantLoader when its RenderView crashes.
174 void InstantLoaderRenderViewGone();
175
176 // Invoked by InstantLoader when the instant page is about to navigate.
177 void InstantLoaderAboutToNavigateMainFrame(const GURL& url);
178
179 // Invoked by the InstantLoader when the instant page wants to navigate to
180 // the speicfied URL.
181 void NavigateToURL(const GURL& url, content::PageTransition transition);
182 166
183 // 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
184 // |debug_events_| doesn't get too large. 168 // |debug_events_| doesn't get too large.
185 void LogDebugEvent(const std::string& info) const; 169 void LogDebugEvent(const std::string& info) const;
186 170
187 // See comments for |debug_events_| below. 171 // See comments for |debug_events_| below.
188 const std::list<std::pair<int64, std::string> >& debug_events() { 172 const std::list<std::pair<int64, std::string> >& debug_events() {
189 return debug_events_; 173 return debug_events_;
190 } 174 }
191 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 // Non-const for Add/RemoveObserver only. Other model changes should only
182 // happen through the InstantController interface.
183 InstantModel* model() { return &model_; }
184
192 private: 185 private:
193 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant); 186 FRIEND_TEST_ALL_PREFIXES(InstantTest, OmniboxFocusLoadsInstant);
194 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL); 187 FRIEND_TEST_ALL_PREFIXES(InstantTest, SetWithTemplateURL);
195 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider); 188 FRIEND_TEST_ALL_PREFIXES(InstantTest, NonInstantSearchProvider);
196 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh); 189 FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantOverlayRefresh);
197 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn); 190 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ExtendedModeIsOn);
198 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant); 191 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, OmniboxFocusLoadsInstant);
192 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded);
193 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab);
194 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab);
195 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation);
196
197 // Overridden from InstantPage::Delegate:
198 virtual void InstantSupportDetermined(
199 const content::WebContents* contents,
200 bool supports_instant) OVERRIDE;
201 virtual void InstantPageRenderViewGone(
202 const content::WebContents* contents) OVERRIDE;
203 virtual void InstantPageAboutToNavigateMainFrame(
204 const content::WebContents* contents,
205 const GURL& url) OVERRIDE;
206 virtual void SetSuggestions(
207 const content::WebContents* contents,
208 const std::vector<InstantSuggestion>& suggestions) OVERRIDE;
209 virtual void ShowInstantPreview(
210 const content::WebContents* contents,
211 InstantShownReason reason,
212 int height,
213 InstantSizeUnits units) OVERRIDE;
214 virtual void StartCapturingKeyStrokes(
215 const content::WebContents* contents) OVERRIDE;
216 virtual void StopCapturingKeyStrokes(content::WebContents* contents) OVERRIDE;
217 virtual void NavigateToURL(
218 const content::WebContents* contents,
219 const GURL& url,
220 content::PageTransition transition) OVERRIDE;
199 221
200 // Helper for OmniboxFocusChanged. Commit or discard the preview. 222 // Helper for OmniboxFocusChanged. Commit or discard the preview.
201 void OmniboxLostFocus(gfx::NativeView view_gaining_focus); 223 void OmniboxLostFocus(gfx::NativeView view_gaining_focus);
202 224
203 // Ensures that |loader_| uses the Instant URL returned by GetInstantURL(), 225 // Creates a new NTP, using the instant_url property of the default
204 // creating a new loader if necessary. In extended mode, will fallback to 226 // TemplateURL.
227 void ResetNTP();
228
229 // Ensures that |overlay_| uses the Instant URL returned by GetInstantURL(),
230 // creating a new overlay if necessary. In extended mode, will fallback to
205 // using the kLocalOmniboxPopupURL as the Instant URL in case GetInstantURL() 231 // using the kLocalOmniboxPopupURL as the Instant URL in case GetInstantURL()
206 // returns false. Returns true if an Instant URL could be determined. 232 // returns false. Returns true if an Instant URL could be determined.
207 bool EnsureLoaderIsCurrent(); 233 bool EnsureOverlayIsCurrent();
208 234
209 // Recreates the |loader_| with the input |instant_url|. The caller should 235 // Recreates the |overlay_| with |instant_url|. Note that |overlay_| is
210 // ensure that the |loader_| is not already on the stack since it is deleted 236 // deleted in this call.
211 // in this call. 237 void CreateOverlay(const std::string& instant_url,
212 void CreateLoader(const std::string& instant_url, 238 const content::WebContents* active_tab);
213 const content::WebContents* active_tab);
214
215 // Called when the |loader_| might be stale. If it's actually stale, and the
216 // omnibox doesn't have focus, and the preview isn't showing, the |loader_| is
217 // deleted and recreated. Else the refresh is skipped.
218 void OnStaleLoader();
219 239
220 // If the active tab is an Instant search results page, sets |instant_tab_| to 240 // If the active tab is an Instant search results page, sets |instant_tab_| to
221 // point to it. Else, deletes any existing |instant_tab_|. 241 // point to it. Else, deletes any existing |instant_tab_|.
222 void ResetInstantTab(); 242 void ResetInstantTab();
223 243
224 // Hide the preview. Also sends an onchange event (with blank query) to the 244 // Hide the preview. Also sends an onchange event (with blank query) to the
225 // preview, telling it to clear out results for any old queries. 245 // preview, telling it to clear out results for any old queries.
226 void HideLoader(); 246 void HideOverlay();
227 247
228 // Like HideLoader(), but doesn't call OnStaleLoader(). Use HideLoader() 248 // Like HideOverlay(), but doesn't call OnStaleOverlay(). Use HideOverlay()
229 // unless you are going to call loader_.reset() yourself subsequently. 249 // unless you are going to call overlay_.reset() yourself subsequently.
230 void HideInternal(); 250 void HideInternal();
231 251
232 // Counterpart to HideLoader(). Asks the |browser_| to display the preview 252 // Counterpart to HideOverlay(). Asks the |browser_| to display the preview
233 // with the given |height|. 253 // with the given |height| in |units|.
234 void ShowLoader(InstantShownReason reason, 254 void ShowOverlay(InstantShownReason reason,
235 int height, 255 int height,
236 InstantSizeUnits units); 256 InstantSizeUnits units);
237 257
238 // Send the omnibox popup bounds to the page. 258 // Send the omnibox popup bounds to the page.
239 void SendPopupBoundsToPage(); 259 void SendPopupBoundsToPage();
240 260
241 // Determines the Instant URL based on a number of factors: 261 // Determines the Instant URL based on a number of factors:
242 // If |extended_enabled_|: 262 // If |extended_enabled_|:
243 // - If |use_local_preview_only_| is true return kLocalOmniboxPopupURL, else 263 // - If |use_local_preview_only_| is true return kLocalOmniboxPopupURL, else
244 // - If the Instant URL is specified by command line, returns it, else 264 // - If the Instant URL is specified by command line, returns it, else
245 // - If the default Instant URL is present returns it. 265 // - If the default Instant URL is present returns it.
246 // If !|extended_enabled_|: 266 // If !|extended_enabled_|:
247 // - If the Instant URL is specified by command line, returns it, else 267 // - If the Instant URL is specified by command line, returns it, else
248 // - If the default Instant URL is present returns it. 268 // - If the default Instant URL is present returns it.
249 // 269 //
250 // Returns true if a valid Instant URL could be found that is not blacklisted. 270 // Returns true if a valid Instant URL could be found that is not blacklisted.
251 bool GetInstantURL(const content::WebContents* active_tab, 271 bool GetInstantURL(Profile* profile, std::string* instant_url) const;
252 std::string* instant_url) const; 272
273 // Adds the URL for the page to the blacklist. Deletes the contents held and
274 // recreates a new page.
275 void BlacklistAndResetOverlay();
276 void BlacklistAndResetNTP();
277
278 // Removes |url| from the blacklist.
279 void RemoveFromBlacklist(const std::string& url);
280
281 InstantOverlay* overlay() const { return overlay_.get(); }
282 InstantTab* instant_tab() const { return instant_tab_.get(); }
283 InstantNTP* ntp() const { return ntp_.get(); }
253 284
254 chrome::BrowserInstantController* const browser_; 285 chrome::BrowserInstantController* const browser_;
255 286
256 // Whether the extended API and regular API are enabled. If both are false, 287 // Whether the extended API and regular API are enabled. If both are false,
257 // Instant is effectively disabled. 288 // Instant is effectively disabled.
258 const bool extended_enabled_; 289 const bool extended_enabled_;
259 bool instant_enabled_; 290 bool instant_enabled_;
260 291
261 // If true, the instant URL is set to kLocalOmniboxPopupURL. 292 // If true, the instant URL is set to kLocalOmniboxPopupURL.
262 const bool use_local_preview_only_; 293 const bool use_local_preview_only_;
263 294
264 // The state of the preview page, i.e., the page owned by |loader_|. Ignored 295 // The state of the preview page, i.e., the page owned by |overlay_|. Ignored
265 // if |instant_tab_| is in use. 296 // if |instant_tab_| is in use.
266 InstantModel model_; 297 InstantModel model_;
267 298
268 // The preview WebContents. 299 // The three instances of InstantPage maintained by InstantController as
269 scoped_ptr<InstantLoader> loader_; 300 // described above. All three may be non-NULL in extended mode. If
270 301 // |instant_tab_| is not NULL, then |overlay_| is guaranteed to be hidden and
271 // A committed WebContents that supports Instant. If non-NULL, the |loader_| 302 // messages will be sent to |instant_tab_| instead.
272 // is guaranteed to be hidden and messages will be sent to this instead. 303 //
304 // In non-extended mode, only |overlay_| is ever non-NULL.
305 scoped_ptr<InstantOverlay> overlay_;
306 scoped_ptr<InstantNTP> ntp_;
273 scoped_ptr<InstantTab> instant_tab_; 307 scoped_ptr<InstantTab> instant_tab_;
274 308
275 // The most recent full_text passed to Update(). If empty, we'll not accept 309 // The most recent full_text passed to Update(). If empty, we'll not accept
276 // search suggestions from |loader_| or |instant_tab_|. 310 // search suggestions from |overlay_| or |instant_tab_|.
277 string16 last_omnibox_text_; 311 string16 last_omnibox_text_;
278 312
279 // True if the last Update() had an inline autocompletion. Used only to make 313 // True if the last Update() had an inline autocompletion. Used only to make
280 // sure that we don't accidentally suggest gray text suggestion in that case. 314 // sure that we don't accidentally suggest gray text suggestion in that case.
281 bool last_omnibox_text_has_inline_autocompletion_; 315 bool last_omnibox_text_has_inline_autocompletion_;
282 316
283 // The most recent verbatim passed to Update(). Used only to ensure that we 317 // The most recent verbatim passed to Update(). Used only to ensure that we
284 // don't accidentally suggest an inline autocompletion. 318 // don't accidentally suggest an inline autocompletion.
285 bool last_verbatim_; 319 bool last_verbatim_;
286 320
(...skipping 22 matching lines...) Expand all
309 343
310 // Size of the start-edge omnibox text area margin. 344 // Size of the start-edge omnibox text area margin.
311 int start_margin_; 345 int start_margin_;
312 346
313 // Size of the end-edge omnibox text area margin. 347 // Size of the end-edge omnibox text area margin.
314 int end_margin_; 348 int end_margin_;
315 349
316 // Timer used to update the bounds of the omnibox popup. 350 // Timer used to update the bounds of the omnibox popup.
317 base::OneShotTimer<InstantController> update_bounds_timer_; 351 base::OneShotTimer<InstantController> update_bounds_timer_;
318 352
319 // Timer used to ensure that the Instant page does not get too stale.
320 base::OneShotTimer<InstantController> stale_loader_timer_;
321
322 // For each key K => value N, the map says that we found that the search 353 // For each key K => value N, the map says that we found that the search
323 // engine identified by Instant URL K didn't support the Instant API, or 354 // engine identified by Instant URL K didn't support the Instant API, or
324 // caused RenderView crashes in each of the last N times that we loaded it. 355 // caused RenderView crashes in each of the last N times that we loaded it.
325 // If an Instant URL isn't present in the map at all or has a value 0, 356 // If an Instant URL isn't present in the map at all or has a value 0,
326 // it means that search engine supports the Instant API (or we assume it does, 357 // it means that search engine supports the Instant API (or we assume it does,
327 // since we haven't determined it doesn't) and it did not cause a crash. 358 // since we haven't determined it doesn't) and it did not cause a crash.
328 std::map<std::string, int> blacklisted_urls_; 359 std::map<std::string, int> blacklisted_urls_;
329 360
330 // Search terms extraction (for autocomplete history matches) doesn't work 361 // Search terms extraction (for autocomplete history matches) doesn't work
331 // on Instant URLs. So, whenever the user commits an Instant search, we add 362 // on Instant URLs. So, whenever the user commits an Instant search, we add
(...skipping 11 matching lines...) Expand all
343 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false. 374 // MODE_SEARCH_SUGGESTIONS, except in those cases where this is false.
344 bool allow_preview_to_show_search_suggestions_; 375 bool allow_preview_to_show_search_suggestions_;
345 376
346 // List of events and their timestamps, useful in debugging Instant behaviour. 377 // List of events and their timestamps, useful in debugging Instant behaviour.
347 mutable std::list<std::pair<int64, std::string> > debug_events_; 378 mutable std::list<std::pair<int64, std::string> > debug_events_;
348 379
349 DISALLOW_COPY_AND_ASSIGN(InstantController); 380 DISALLOW_COPY_AND_ASSIGN(InstantController);
350 }; 381 };
351 382
352 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_ 383 #endif // CHROME_BROWSER_INSTANT_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698