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

Unified Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 10553029: Handle interface to prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediation to reviews, and unit test improvements. Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/omnibox/omnibox_edit_model.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
index 9c0ddd5173c257666d555c76faf7a1b4d49820d9..0b5c16df829611d86dc261a106c82b9b498235cd 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -1094,28 +1094,27 @@ bool OmniboxEditModel::DoInstant(const AutocompleteMatch& match,
return false;
}
-void OmniboxEditModel::DoPrerender(const AutocompleteMatch& match) {
+void OmniboxEditModel::DoPrerender(
dominich 2012/07/02 20:43:03 this should still fit on one line.
gavinp 2012/07/03 16:41:02 Done.
+ const AutocompleteMatch& match) {
// Do not prerender if the destination URL is the same as the current URL.
if (match.destination_url == PermanentURL())
return;
// It's possible the tab strip does not have an active tab contents, for
// instance if the tab has been closed or on return from a sleep state
// (http://crbug.com/105689)
- TabContents* tab = controller_->GetTabContents();
- if (!tab)
- return;
- prerender::PrerenderManager* prerender_manager =
- prerender::PrerenderManagerFactory::GetForProfile(tab->profile());
- if (!prerender_manager)
- return;
- content::RenderViewHost* current_host =
- tab->web_contents()->GetRenderViewHost();
- gfx::Rect container_bounds;
- tab->web_contents()->GetView()->GetContainerBounds(&container_bounds);
- prerender_manager->AddPrerenderFromOmnibox(
- match.destination_url, current_host->GetSessionStorageNamespace(),
- container_bounds.size());
+ if (TabContents* tab = controller_->GetTabContents()) {
+ gfx::Rect container_bounds;
+ tab->web_contents()->GetView()->GetContainerBounds(&container_bounds);
+ content::RenderViewHost* current_host =
+ tab->web_contents()->GetRenderViewHost();
+ AutocompleteActionPredictor* action_predictor =
+ AutocompleteActionPredictorFactory::GetForProfile(profile_);
+
+ action_predictor->StartPrerendering(
+ match.destination_url,
+ current_host->GetSessionStorageNamespace(), container_bounds.size());
+ }
}
void OmniboxEditModel::DoPreconnect(const AutocompleteMatch& match) {

Powered by Google App Engine
This is Rietveld 408576698