| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 predictors::AutocompleteActionPredictor::IsPreconnectable(match)); | 450 predictors::AutocompleteActionPredictor::IsPreconnectable(match)); |
| 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 InstantSearchPrerenderer* prerenderer = |
| 461 // TODO(treib): This check should probably be removed - IsSearchResultsPage | 461 InstantSearchPrerenderer::GetForProfile(profile_); |
| 462 // will always return false here, because it'll only be true for pages | 462 if (prerenderer) |
| 463 // rendered in the Instant process. crbug.com/627747 | 463 prerenderer->Prerender(suggestion); |
| 464 if (!web_contents || | |
| 465 !SearchTabHelper::FromWebContents(web_contents)->IsSearchResultsPage()) { | |
| 466 InstantSearchPrerenderer* prerenderer = | |
| 467 InstantSearchPrerenderer::GetForProfile(profile_); | |
| 468 if (prerenderer) | |
| 469 prerenderer->Prerender(suggestion); | |
| 470 } | |
| 471 } | 464 } |
| 472 | 465 |
| 473 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, | 466 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, |
| 474 const SkBitmap& bitmap) { | 467 const SkBitmap& bitmap) { |
| 475 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; | 468 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; |
| 476 callback.Run(bitmap); | 469 callback.Run(bitmap); |
| 477 } | 470 } |
| OLD | NEW |