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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 content::NavigationController::LoadURLParams params(url_); | 126 content::NavigationController::LoadURLParams params(url_); |
127 prerender_contents_->GetController().LoadURLWithParams(params); | 127 prerender_contents_->GetController().LoadURLWithParams(params); |
128 SearchTabHelper::CreateForWebContents(prerender_contents_.get()); | 128 SearchTabHelper::CreateForWebContents(prerender_contents_.get()); |
129 | 129 |
130 prerendering_has_started_ = true; | 130 prerendering_has_started_ = true; |
131 DCHECK(session_storage_namespace); | 131 DCHECK(session_storage_namespace); |
132 session_storage_namespace_id_ = session_storage_namespace->id(); | 132 session_storage_namespace_id_ = session_storage_namespace->id(); |
133 NotifyPrerenderStart(); | 133 NotifyPrerenderStart(); |
134 | 134 |
135 if (call_did_finish_load_) | 135 if (call_did_finish_load_) |
136 DidFinishLoad(1, url_, true, NULL); | 136 DidFinishLoad(prerender_contents_->GetMainFrame(), url_); |
137 } | 137 } |
138 | 138 |
139 bool DummyPrerenderContents::GetChildId(int* child_id) const { | 139 bool DummyPrerenderContents::GetChildId(int* child_id) const { |
140 *child_id = 1; | 140 *child_id = 1; |
141 return true; | 141 return true; |
142 } | 142 } |
143 | 143 |
144 bool DummyPrerenderContents::GetRouteId(int* route_id) const { | 144 bool DummyPrerenderContents::GetRouteId(int* route_id) const { |
145 *route_id = 1; | 145 *route_id = 1; |
146 return true; | 146 return true; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 // key. Make sure UsePrerenderedPage() extracts the search terms from the URL | 491 // key. Make sure UsePrerenderedPage() extracts the search terms from the URL |
492 // and uses the prerendered page contents. | 492 // and uses the prerendered page contents. |
493 GURL url("https://www.google.com/alt#quux=foo"); | 493 GURL url("https://www.google.com/alt#quux=foo"); |
494 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB, | 494 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB, |
495 content::PAGE_TRANSITION_TYPED, | 495 content::PAGE_TRANSITION_TYPED, |
496 false)); | 496 false)); |
497 EXPECT_EQ(GetPrerenderURL(), GetActiveWebContents()->GetURL()); | 497 EXPECT_EQ(GetPrerenderURL(), GetActiveWebContents()->GetURL()); |
498 EXPECT_EQ(static_cast<PrerenderHandle*>(NULL), prerender_handle()); | 498 EXPECT_EQ(static_cast<PrerenderHandle*>(NULL), prerender_handle()); |
499 } | 499 } |
500 #endif | 500 #endif |
OLD | NEW |