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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 2983533002: Revert of Provide WebContents::CreateParams to tab helpers. (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 DCHECK_EQ(1U, alias_urls_.size()); 280 DCHECK_EQ(1U, alias_urls_.size());
281 281
282 session_storage_namespace_id_ = session_storage_namespace->id(); 282 session_storage_namespace_id_ = session_storage_namespace->id();
283 bounds_ = bounds; 283 bounds_ = bounds;
284 284
285 DCHECK(load_start_time_.is_null()); 285 DCHECK(load_start_time_.is_null());
286 load_start_time_ = base::TimeTicks::Now(); 286 load_start_time_ = base::TimeTicks::Now();
287 287
288 prerendering_has_started_ = true; 288 prerendering_has_started_ = true;
289 289
290 content::WebContents::CreateParams create_params = 290 prerender_contents_.reset(CreateWebContents(session_storage_namespace));
291 WebContents::CreateParams(profile_); 291 TabHelpers::AttachTabHelpers(prerender_contents_.get());
292 prerender_contents_.reset(
293 CreateWebContents(create_params, session_storage_namespace));
294 TabHelpers::AttachTabHelpers(prerender_contents_.get(), create_params);
295 content::WebContentsObserver::Observe(prerender_contents_.get()); 292 content::WebContentsObserver::Observe(prerender_contents_.get());
296 293
297 // Tag the prerender contents with the task manager specific prerender tag, so 294 // Tag the prerender contents with the task manager specific prerender tag, so
298 // that it shows up in the task manager. 295 // that it shows up in the task manager.
299 task_manager::WebContentsTags::CreateForPrerenderContents( 296 task_manager::WebContentsTags::CreateForPrerenderContents(
300 prerender_contents_.get()); 297 prerender_contents_.get());
301 298
302 web_contents_delegate_.reset(new WebContentsDelegateImpl(this)); 299 web_contents_delegate_.reset(new WebContentsDelegateImpl(this));
303 prerender_contents_.get()->SetDelegate(web_contents_delegate_.get()); 300 prerender_contents_.get()->SetDelegate(web_contents_delegate_.get());
304 // Set the size of the prerender WebContents. 301 // Set the size of the prerender WebContents.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 NOTREACHED() << "Unexpected notification sent."; 440 NOTREACHED() << "Unexpected notification sent.";
444 break; 441 break;
445 } 442 }
446 } 443 }
447 444
448 void PrerenderContents::OnRenderViewHostCreated( 445 void PrerenderContents::OnRenderViewHostCreated(
449 RenderViewHost* new_render_view_host) { 446 RenderViewHost* new_render_view_host) {
450 } 447 }
451 448
452 WebContents* PrerenderContents::CreateWebContents( 449 WebContents* PrerenderContents::CreateWebContents(
453 const content::WebContents::CreateParams& create_params,
454 SessionStorageNamespace* session_storage_namespace) { 450 SessionStorageNamespace* session_storage_namespace) {
455 // TODO(ajwong): Remove the temporary map once prerendering is aware of 451 // TODO(ajwong): Remove the temporary map once prerendering is aware of
456 // multiple session storage namespaces per tab. 452 // multiple session storage namespaces per tab.
457 content::SessionStorageNamespaceMap session_storage_namespace_map; 453 content::SessionStorageNamespaceMap session_storage_namespace_map;
458 session_storage_namespace_map[std::string()] = session_storage_namespace; 454 session_storage_namespace_map[std::string()] = session_storage_namespace;
459 return WebContents::CreateWithSessionStorage(create_params, 455 return WebContents::CreateWithSessionStorage(
460 session_storage_namespace_map); 456 WebContents::CreateParams(profile_), session_storage_namespace_map);
461 } 457 }
462 458
463 void PrerenderContents::NotifyPrerenderStart() { 459 void PrerenderContents::NotifyPrerenderStart() {
464 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); 460 DCHECK_EQ(FINAL_STATUS_MAX, final_status_);
465 for (Observer& observer : observer_list_) 461 for (Observer& observer : observer_list_)
466 observer.OnPrerenderStart(this); 462 observer.OnPrerenderStart(this);
467 } 463 }
468 464
469 void PrerenderContents::NotifyPrerenderStopLoading() { 465 void PrerenderContents::NotifyPrerenderStopLoading() {
470 for (Observer& observer : observer_list_) 466 for (Observer& observer : observer_list_)
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 idle_resources_.push_back(throttle); 789 idle_resources_.push_back(throttle);
794 } 790 }
795 791
796 void PrerenderContents::AddNetworkBytes(int64_t bytes) { 792 void PrerenderContents::AddNetworkBytes(int64_t bytes) {
797 network_bytes_ += bytes; 793 network_bytes_ += bytes;
798 for (Observer& observer : observer_list_) 794 for (Observer& observer : observer_list_)
799 observer.OnPrerenderNetworkBytesChanged(this); 795 observer.OnPrerenderNetworkBytesChanged(this);
800 } 796 }
801 797
802 } // namespace prerender 798 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698