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

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

Issue 104833006: Switch ContentSettingsObserver to be a RenderFrameObserver instead of a RenderViewObserver (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years 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 | Annotate | Revision Log
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 <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 PrerenderContents::PendingPrerenderInfo::~PendingPrerenderInfo() { 157 PrerenderContents::PendingPrerenderInfo::~PendingPrerenderInfo() {
158 } 158 }
159 159
160 void PrerenderContents::AddPendingPrerender( 160 void PrerenderContents::AddPendingPrerender(
161 scoped_ptr<PendingPrerenderInfo> pending_prerender_info) { 161 scoped_ptr<PendingPrerenderInfo> pending_prerender_info) {
162 pending_prerenders_.push_back(pending_prerender_info.release()); 162 pending_prerenders_.push_back(pending_prerender_info.release());
163 } 163 }
164 164
165 void PrerenderContents::PrepareForUse() { 165 void PrerenderContents::PrepareForUse() {
166 for (std::set<content::RenderFrameHost*>::iterator i = 166 if (prerender_contents_.get()) {
167 render_frame_hosts_.begin(); i != render_frame_hosts_.end(); ++i) { 167 prerender_contents_->SendToAllFrames(
168 (*i)->Send(new PrerenderMsg_SetIsPrerendering((*i)->GetRoutingID(), false)); 168 new PrerenderMsg_SetIsPrerendering(MSG_ROUTING_NONE, false));
169 } 169 }
170 render_frame_hosts_.clear();
171 170
172 NotifyPrerenderStop(); 171 NotifyPrerenderStop();
173 172
174 SessionStorageNamespace* session_storage_namespace = NULL; 173 SessionStorageNamespace* session_storage_namespace = NULL;
175 if (prerender_contents_) { 174 if (prerender_contents_) {
176 // TODO(ajwong): This does not correctly handle storage for isolated apps. 175 // TODO(ajwong): This does not correctly handle storage for isolated apps.
177 session_storage_namespace = prerender_contents_-> 176 session_storage_namespace = prerender_contents_->
178 GetController().GetDefaultSessionStorageNamespace(); 177 GetController().GetDefaultSessionStorageNamespace();
179 } 178 }
180 prerender_manager_->StartPendingPrerenders( 179 prerender_manager_->StartPendingPrerenders(
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 return std::count_if(alias_urls_.begin(), alias_urls_.end(), 539 return std::count_if(alias_urls_.begin(), alias_urls_.end(),
541 std::bind2nd(std::equal_to<GURL>(), url)) != 0; 540 std::bind2nd(std::equal_to<GURL>(), url)) != 0;
542 } 541 }
543 542
544 void PrerenderContents::RenderProcessGone(base::TerminationStatus status) { 543 void PrerenderContents::RenderProcessGone(base::TerminationStatus status) {
545 Destroy(FINAL_STATUS_RENDERER_CRASHED); 544 Destroy(FINAL_STATUS_RENDERER_CRASHED);
546 } 545 }
547 546
548 void PrerenderContents::RenderFrameCreated( 547 void PrerenderContents::RenderFrameCreated(
549 content::RenderFrameHost* render_frame_host) { 548 content::RenderFrameHost* render_frame_host) {
550 render_frame_hosts_.insert(render_frame_host);
551 // When a new RenderFrame is created for a prerendering WebContents, tell the 549 // When a new RenderFrame is created for a prerendering WebContents, tell the
552 // new RenderFrame it's being used for prerendering before any navigations 550 // new RenderFrame it's being used for prerendering before any navigations
553 // occur. Note that this is always triggered before the first navigation, so 551 // occur. Note that this is always triggered before the first navigation, so
554 // there's no need to send the message just after the WebContents is created. 552 // there's no need to send the message just after the WebContents is created.
555 render_frame_host->Send(new PrerenderMsg_SetIsPrerendering( 553 render_frame_host->Send(new PrerenderMsg_SetIsPrerendering(
556 render_frame_host->GetRoutingID(), true)); 554 render_frame_host->GetRoutingID(), true));
557 } 555 }
558 556
559 void PrerenderContents::RenderFrameDeleted(
560 content::RenderFrameHost* render_frame_host) {
561 render_frame_hosts_.erase(render_frame_host);
562 }
563
564 void PrerenderContents::DidStopLoading( 557 void PrerenderContents::DidStopLoading(
565 content::RenderViewHost* render_view_host) { 558 content::RenderViewHost* render_view_host) {
566 has_stopped_loading_ = true; 559 has_stopped_loading_ = true;
567 NotifyPrerenderStopLoading(); 560 NotifyPrerenderStopLoading();
568 } 561 }
569 562
570 void PrerenderContents::DidStartProvisionalLoadForFrame( 563 void PrerenderContents::DidStartProvisionalLoadForFrame(
571 int64 frame_id, 564 int64 frame_id,
572 int64 parent_frame_id, 565 int64 parent_frame_id,
573 bool is_main_frame, 566 bool is_main_frame,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 return NULL; 754 return NULL;
762 return prerender_contents()->GetController(). 755 return prerender_contents()->GetController().
763 GetDefaultSessionStorageNamespace(); 756 GetDefaultSessionStorageNamespace();
764 } 757 }
765 758
766 void PrerenderContents::OnCancelPrerenderForPrinting() { 759 void PrerenderContents::OnCancelPrerenderForPrinting() {
767 Destroy(FINAL_STATUS_WINDOW_PRINT); 760 Destroy(FINAL_STATUS_WINDOW_PRINT);
768 } 761 }
769 762
770 } // namespace prerender 763 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/renderer_host/chrome_render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698