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