| 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 int ALLOW_UNUSED creator_child_id, | 114 int ALLOW_UNUSED creator_child_id, |
| 115 const gfx::Size& ALLOW_UNUSED size, | 115 const gfx::Size& ALLOW_UNUSED size, |
| 116 content::SessionStorageNamespace* session_storage_namespace) { | 116 content::SessionStorageNamespace* session_storage_namespace) { |
| 117 prerender_contents_.reset(content::WebContents::CreateWithSessionStorage( | 117 prerender_contents_.reset(content::WebContents::CreateWithSessionStorage( |
| 118 content::WebContents::CreateParams(profile_), | 118 content::WebContents::CreateParams(profile_), |
| 119 session_storage_namespace_map_)); | 119 session_storage_namespace_map_)); |
| 120 content::NavigationController::LoadURLParams params(url_); | 120 content::NavigationController::LoadURLParams params(url_); |
| 121 prerender_contents_->GetController().LoadURLWithParams(params); | 121 prerender_contents_->GetController().LoadURLWithParams(params); |
| 122 SearchTabHelper::CreateForWebContents(prerender_contents_.get()); | 122 SearchTabHelper::CreateForWebContents(prerender_contents_.get()); |
| 123 | 123 |
| 124 AddObserver(prerender_manager()->prerender_tracker()); | |
| 125 prerendering_has_started_ = true; | 124 prerendering_has_started_ = true; |
| 126 DCHECK(session_storage_namespace); | 125 DCHECK(session_storage_namespace); |
| 127 session_storage_namespace_id_ = session_storage_namespace->id(); | 126 session_storage_namespace_id_ = session_storage_namespace->id(); |
| 128 NotifyPrerenderStart(); | 127 NotifyPrerenderStart(); |
| 129 | 128 |
| 130 if (call_did_finish_load_) | 129 if (call_did_finish_load_) |
| 131 DidFinishLoad(1, url_, true, NULL); | 130 DidFinishLoad(1, url_, true, NULL); |
| 132 } | 131 } |
| 133 | 132 |
| 134 bool DummyPrerenderContents::GetChildId(int* child_id) const { | 133 bool DummyPrerenderContents::GetChildId(int* child_id) const { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // Open a search results page. Make sure the InstantSearchPrerenderer cancels | 394 // Open a search results page. Make sure the InstantSearchPrerenderer cancels |
| 396 // the active prerender request upon the receipt of empty search query. | 395 // the active prerender request upon the receipt of empty search query. |
| 397 GURL url("https://www.google.com/alt#quux=&strk"); | 396 GURL url("https://www.google.com/alt#quux=&strk"); |
| 398 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB, | 397 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB, |
| 399 content::PAGE_TRANSITION_TYPED, | 398 content::PAGE_TRANSITION_TYPED, |
| 400 false)); | 399 false)); |
| 401 EXPECT_NE(GetPrerenderURL(), GetActiveWebContents()->GetURL()); | 400 EXPECT_NE(GetPrerenderURL(), GetActiveWebContents()->GetURL()); |
| 402 EXPECT_EQ(url, GetActiveWebContents()->GetURL()); | 401 EXPECT_EQ(url, GetActiveWebContents()->GetURL()); |
| 403 EXPECT_EQ(static_cast<PrerenderHandle*>(NULL), prerender_handle()); | 402 EXPECT_EQ(static_cast<PrerenderHandle*>(NULL), prerender_handle()); |
| 404 } | 403 } |
| OLD | NEW |