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

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: 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 prerender_contents_->SendToAllFrames(
167 render_frame_hosts_.begin(); i != render_frame_hosts_.end(); ++i) { 167 new PrerenderMsg_SetIsPrerendering(MSG_ROUTING_NONE, false));
168 (*i)->Send(new PrerenderMsg_SetIsPrerendering((*i)->GetRoutingID(), false));
169 }
170 render_frame_hosts_.clear();
171 168
172 NotifyPrerenderStop(); 169 NotifyPrerenderStop();
173 170
174 SessionStorageNamespace* session_storage_namespace = NULL; 171 SessionStorageNamespace* session_storage_namespace = NULL;
175 if (prerender_contents_) { 172 if (prerender_contents_) {
176 // TODO(ajwong): This does not correctly handle storage for isolated apps. 173 // TODO(ajwong): This does not correctly handle storage for isolated apps.
177 session_storage_namespace = prerender_contents_-> 174 session_storage_namespace = prerender_contents_->
178 GetController().GetDefaultSessionStorageNamespace(); 175 GetController().GetDefaultSessionStorageNamespace();
179 } 176 }
180 prerender_manager_->StartPendingPrerenders( 177 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(), 537 return std::count_if(alias_urls_.begin(), alias_urls_.end(),
541 std::bind2nd(std::equal_to<GURL>(), url)) != 0; 538 std::bind2nd(std::equal_to<GURL>(), url)) != 0;
542 } 539 }
543 540
544 void PrerenderContents::RenderProcessGone(base::TerminationStatus status) { 541 void PrerenderContents::RenderProcessGone(base::TerminationStatus status) {
545 Destroy(FINAL_STATUS_RENDERER_CRASHED); 542 Destroy(FINAL_STATUS_RENDERER_CRASHED);
546 } 543 }
547 544
548 void PrerenderContents::RenderFrameCreated( 545 void PrerenderContents::RenderFrameCreated(
549 content::RenderFrameHost* render_frame_host) { 546 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 547 // When a new RenderFrame is created for a prerendering WebContents, tell the
552 // new RenderFrame it's being used for prerendering before any navigations 548 // new RenderFrame it's being used for prerendering before any navigations
553 // occur. Note that this is always triggered before the first navigation, so 549 // 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. 550 // there's no need to send the message just after the WebContents is created.
555 render_frame_host->Send(new PrerenderMsg_SetIsPrerendering( 551 render_frame_host->Send(new PrerenderMsg_SetIsPrerendering(
556 render_frame_host->GetRoutingID(), true)); 552 render_frame_host->GetRoutingID(), true));
557 } 553 }
558 554
559 void PrerenderContents::RenderFrameDeleted(
560 content::RenderFrameHost* render_frame_host) {
561 render_frame_hosts_.erase(render_frame_host);
562 }
563
564 void PrerenderContents::DidStopLoading( 555 void PrerenderContents::DidStopLoading(
565 content::RenderViewHost* render_view_host) { 556 content::RenderViewHost* render_view_host) {
566 has_stopped_loading_ = true; 557 has_stopped_loading_ = true;
567 NotifyPrerenderStopLoading(); 558 NotifyPrerenderStopLoading();
568 } 559 }
569 560
570 void PrerenderContents::DidStartProvisionalLoadForFrame( 561 void PrerenderContents::DidStartProvisionalLoadForFrame(
571 int64 frame_id, 562 int64 frame_id,
572 int64 parent_frame_id, 563 int64 parent_frame_id,
573 bool is_main_frame, 564 bool is_main_frame,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 return NULL; 752 return NULL;
762 return prerender_contents()->GetController(). 753 return prerender_contents()->GetController().
763 GetDefaultSessionStorageNamespace(); 754 GetDefaultSessionStorageNamespace();
764 } 755 }
765 756
766 void PrerenderContents::OnCancelPrerenderForPrinting() { 757 void PrerenderContents::OnCancelPrerenderForPrinting() {
767 Destroy(FINAL_STATUS_WINDOW_PRINT); 758 Destroy(FINAL_STATUS_WINDOW_PRINT);
768 } 759 }
769 760
770 } // namespace prerender 761 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698