Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" | 5 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 } | 451 } |
| 452 // We could prefetch the alternate nav URL, if any, but because there | 452 // We could prefetch the alternate nav URL, if any, but because there |
| 453 // can be many of these as a user types an initial series of characters, | 453 // can be many of these as a user types an initial series of characters, |
| 454 // the OS DNS cache could suffer eviction problems for minimal gain. | 454 // the OS DNS cache could suffer eviction problems for minimal gain. |
| 455 } | 455 } |
| 456 | 456 |
| 457 void ChromeOmniboxClient::SetSuggestionToPrefetch( | 457 void ChromeOmniboxClient::SetSuggestionToPrefetch( |
| 458 const InstantSuggestion& suggestion) { | 458 const InstantSuggestion& suggestion) { |
| 459 DCHECK(search::IsInstantExtendedAPIEnabled()); | 459 DCHECK(search::IsInstantExtendedAPIEnabled()); |
| 460 content::WebContents* web_contents = controller_->GetWebContents(); | 460 content::WebContents* web_contents = controller_->GetWebContents(); |
| 461 if (web_contents && | 461 if (!web_contents || |
| 462 SearchTabHelper::FromWebContents(web_contents)->IsSearchResultsPage()) { | 462 !SearchTabHelper::FromWebContents(web_contents)->IsSearchResultsPage()) { |
|
Marc Treib
2016/07/29 10:40:14
I've investigated a bit more, and it seems that Is
| |
| 463 if (search::ShouldPrefetchSearchResultsOnSRP()) { | |
| 464 SearchTabHelper::FromWebContents(web_contents)-> | |
| 465 SetSuggestionToPrefetch(suggestion); | |
| 466 } | |
| 467 } else { | |
| 468 InstantSearchPrerenderer* prerenderer = | 463 InstantSearchPrerenderer* prerenderer = |
| 469 InstantSearchPrerenderer::GetForProfile(profile_); | 464 InstantSearchPrerenderer::GetForProfile(profile_); |
| 470 if (prerenderer) | 465 if (prerenderer) |
| 471 prerenderer->Prerender(suggestion); | 466 prerenderer->Prerender(suggestion); |
| 472 } | 467 } |
| 473 } | 468 } |
| 474 | 469 |
| 475 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, | 470 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, |
| 476 const SkBitmap& bitmap) { | 471 const SkBitmap& bitmap) { |
| 477 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; | 472 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; |
| 478 callback.Run(bitmap); | 473 callback.Run(bitmap); |
| 479 } | 474 } |
| OLD | NEW |