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_UI_SEARCH_INSTANT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 MiddleClickOnSuggestionOpensInNewTab); | 209 MiddleClickOnSuggestionOpensInNewTab); |
210 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); | 210 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, NTPIsPreloaded); |
211 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); | 211 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInNewTab); |
212 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); | 212 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPIsUsedInSameTab); |
213 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPForWrongProvider); | 213 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, PreloadedNTPForWrongProvider); |
214 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 214 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
215 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); | 215 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, UnrelatedSiteInstance); |
216 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ValidatesSuggestions); | 216 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ValidatesSuggestions); |
217 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, | 217 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, |
218 OmniboxCommitsWhenShownFullHeight); | 218 OmniboxCommitsWhenShownFullHeight); |
| 219 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, LocalNTPIsNotLocalOverlay); |
219 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 220 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
220 MANUAL_OmniboxFocusLoadsInstant); | 221 MANUAL_OmniboxFocusLoadsInstant); |
221 | 222 |
222 // Overridden from content::NotificationObserver: | 223 // Overridden from content::NotificationObserver: |
223 virtual void Observe(int type, | 224 virtual void Observe(int type, |
224 const content::NotificationSource& source, | 225 const content::NotificationSource& source, |
225 const content::NotificationDetails& details) OVERRIDE; | 226 const content::NotificationDetails& details) OVERRIDE; |
226 | 227 |
227 // Overridden from InstantPage::Delegate: | 228 // Overridden from InstantPage::Delegate: |
228 // TODO(shishir): We assume that the WebContent's current RenderViewHost is | 229 // TODO(shishir): We assume that the WebContent's current RenderViewHost is |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // unless you are going to call overlay_.reset() yourself subsequently. | 306 // unless you are going to call overlay_.reset() yourself subsequently. |
306 void HideInternal(); | 307 void HideInternal(); |
307 | 308 |
308 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay | 309 // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay |
309 // with the given |height| in |units|. | 310 // with the given |height| in |units|. |
310 void ShowOverlay(int height, InstantSizeUnits units); | 311 void ShowOverlay(int height, InstantSizeUnits units); |
311 | 312 |
312 // Send the omnibox popup bounds to the page. | 313 // Send the omnibox popup bounds to the page. |
313 void SendPopupBoundsToPage(); | 314 void SendPopupBoundsToPage(); |
314 | 315 |
315 // Determines the Instant URL based on a number of factors: | 316 // Returns the default search engine's Instant URL (possibly overridden by |
316 // If |extended_enabled_|: | 317 // the --instant-url commandline param), if it's not blacklisted already. |
317 // - If |use_local_overlay_only_| is true return kLocalOmniboxPopupURL, else | 318 // Ignores the blacklist if |ignore_blacklist| is true. Returns true if a |
318 // - If the Instant URL is specified by command line, returns it, else | 319 // valid Instant URL was assigned to |instant_url|; false otherwise. |
319 // - If the default Instant URL is present returns it. | |
320 // If !|extended_enabled_|: | |
321 // - If the Instant URL is specified by command line, returns it, else | |
322 // - If the default Instant URL is present returns it. | |
323 // | |
324 // If |ignore_blacklist| is set to true, Instant URLs are not filtered through | |
325 // the blacklist. | |
326 // | |
327 // Returns true if a valid Instant URL could be found that is not blacklisted. | |
328 bool GetInstantURL(Profile* profile, | 320 bool GetInstantURL(Profile* profile, |
329 bool ignore_blacklist, | 321 bool ignore_blacklist, |
330 std::string* instant_url) const; | 322 std::string* instant_url) const; |
331 | 323 |
332 // Adds the URL for the page to the blacklist. Deletes the contents held and | 324 // Adds the URL for the page to the blacklist. Deletes the contents held and |
333 // recreates a new page. | 325 // recreates a new page. |
334 void BlacklistAndResetOverlay(); | 326 void BlacklistAndResetOverlay(); |
335 void BlacklistAndResetNTP(); | 327 void BlacklistAndResetNTP(); |
336 | 328 |
337 // Removes |url| from the blacklist. | 329 // Removes |url| from the blacklist. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 // Used for Top Sites async retrieval. | 464 // Used for Top Sites async retrieval. |
473 base::WeakPtrFactory<InstantController> weak_ptr_factory_; | 465 base::WeakPtrFactory<InstantController> weak_ptr_factory_; |
474 | 466 |
475 // Used to get notifications about Most Visted changes. | 467 // Used to get notifications about Most Visted changes. |
476 content::NotificationRegistrar registrar_; | 468 content::NotificationRegistrar registrar_; |
477 | 469 |
478 DISALLOW_COPY_AND_ASSIGN(InstantController); | 470 DISALLOW_COPY_AND_ASSIGN(InstantController); |
479 }; | 471 }; |
480 | 472 |
481 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ | 473 #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_CONTROLLER_H_ |
OLD | NEW |