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/search/instant_search_prerenderer.h" | 5 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 | 115 |
116 void DummyPrerenderContents::StartPrerendering( | 116 void DummyPrerenderContents::StartPrerendering( |
117 int creator_child_id, | 117 int creator_child_id, |
118 const gfx::Size& size, | 118 const gfx::Size& size, |
119 content::SessionStorageNamespace* session_storage_namespace, | 119 content::SessionStorageNamespace* session_storage_namespace, |
120 net::URLRequestContextGetter* request_context) { | 120 net::URLRequestContextGetter* request_context) { |
121 prerender_contents_.reset(content::WebContents::CreateWithSessionStorage( | 121 prerender_contents_.reset(content::WebContents::CreateWithSessionStorage( |
122 content::WebContents::CreateParams(profile_), | 122 content::WebContents::CreateParams(profile_), |
123 session_storage_namespace_map_)); | 123 session_storage_namespace_map_)); |
124 PrerenderTabHelper::CreateForWebContentsWithPasswordManager( | 124 PrerenderTabHelper::CreateForWebContents(prerender_contents_.get()); |
125 prerender_contents_.get(), NULL); | |
126 content::NavigationController::LoadURLParams params(url_); | 125 content::NavigationController::LoadURLParams params(url_); |
127 prerender_contents_->GetController().LoadURLWithParams(params); | 126 prerender_contents_->GetController().LoadURLWithParams(params); |
128 SearchTabHelper::CreateForWebContents(prerender_contents_.get()); | 127 SearchTabHelper::CreateForWebContents(prerender_contents_.get()); |
129 | 128 |
130 prerendering_has_started_ = true; | 129 prerendering_has_started_ = true; |
131 DCHECK(session_storage_namespace); | 130 DCHECK(session_storage_namespace); |
132 session_storage_namespace_id_ = session_storage_namespace->id(); | 131 session_storage_namespace_id_ = session_storage_namespace->id(); |
133 NotifyPrerenderStart(); | 132 NotifyPrerenderStart(); |
134 | 133 |
135 if (call_did_finish_load_) | 134 if (call_did_finish_load_) |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // key. Make sure UsePrerenderedPage() extracts the search terms from the URL | 486 // key. Make sure UsePrerenderedPage() extracts the search terms from the URL |
488 // and uses the prerendered page contents. | 487 // and uses the prerendered page contents. |
489 GURL url("https://www.google.com/alt#quux=foo"); | 488 GURL url("https://www.google.com/alt#quux=foo"); |
490 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB, | 489 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB, |
491 ui::PAGE_TRANSITION_TYPED, | 490 ui::PAGE_TRANSITION_TYPED, |
492 false)); | 491 false)); |
493 EXPECT_EQ(GetPrerenderURL(), GetActiveWebContents()->GetURL()); | 492 EXPECT_EQ(GetPrerenderURL(), GetActiveWebContents()->GetURL()); |
494 EXPECT_EQ(static_cast<PrerenderHandle*>(NULL), prerender_handle()); | 493 EXPECT_EQ(static_cast<PrerenderHandle*>(NULL), prerender_handle()); |
495 } | 494 } |
496 #endif | 495 #endif |
OLD | NEW |