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

Unified Diff: content/browser/web_contents/web_contents_impl.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/content_shell.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
===================================================================
--- content/browser/web_contents/web_contents_impl.cc (revision 241294)
+++ content/browser/web_contents/web_contents_impl.cc (working copy)
@@ -279,6 +279,19 @@
return true;
}
+bool ForEachFrameInternal(
+ const base::Callback<void(RenderFrameHost*)>& on_frame,
+ FrameTreeNode* node) {
+ on_frame.Run(node->render_frame_host());
+ return true;
+}
+
+void SendToAllFramesInternal(IPC::Message* message, RenderFrameHost* rfh) {
+ IPC::Message* message_copy = new IPC::Message(*message);
+ message_copy->set_routing_id(rfh->GetRoutingID());
+ rfh->Send(message_copy);
+}
+
} // namespace
WebContents* WebContents::Create(const WebContents::CreateParams& params) {
@@ -321,6 +334,13 @@
return rvh->GetDelegate()->GetAsWebContents();
}
+WebContents* WebContents::FromRenderFrameHost(RenderFrameHost* rfh) {
+ RenderFrameHostImpl* rfh_impl = static_cast<RenderFrameHostImpl*>(rfh);
+ if (!rfh_impl)
+ return NULL;
+ return rfh_impl->delegate()->GetAsWebContents();
+}
+
// WebContentsImpl::DestructionObserver ----------------------------------------
class WebContentsImpl::DestructionObserver : public WebContentsObserver {
@@ -634,6 +654,16 @@
return frame_tree_.root()->render_frame_host();
}
+void WebContentsImpl::ForEachFrame(
+ const base::Callback<void(RenderFrameHost*)>& on_frame) {
+ frame_tree_.ForEach(base::Bind(&ForEachFrameInternal, on_frame));
+}
+
+void WebContentsImpl::SendToAllFrames(IPC::Message* message) {
+ ForEachFrame(base::Bind(&SendToAllFramesInternal, message));
+ delete message;
+}
+
RenderViewHost* WebContentsImpl::GetRenderViewHost() const {
return GetRenderManager()->current_host();
}
@@ -874,9 +904,9 @@
std::set<GURL> WebContentsImpl::GetSitesInTab() const {
std::set<GURL> sites;
- frame_tree_.ForEach(Bind(&CollectSites,
- base::Unretained(GetBrowserContext()),
- base::Unretained(&sites)));
+ frame_tree_.ForEach(base::Bind(&CollectSites,
+ base::Unretained(GetBrowserContext()),
+ base::Unretained(&sites)));
return sites;
}
@@ -1668,10 +1698,10 @@
reload_type);
}
-void WebContentsImpl::RenderViewForInterstitialPageCreated(
- RenderViewHost* render_view_host) {
+void WebContentsImpl::RenderFrameForInterstitialPageCreated(
+ RenderFrameHost* render_frame_host) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
- RenderViewForInterstitialPageCreated(render_view_host));
+ RenderFrameForInterstitialPageCreated(render_frame_host));
}
void WebContentsImpl::AttachInterstitialPage(
@@ -2779,6 +2809,10 @@
RenderFrameDeleted(render_frame_host));
}
+WebContents* WebContentsImpl::GetAsWebContents() {
+ return this;
+}
+
RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() {
return render_view_host_delegate_view_;
}
@@ -2793,10 +2827,6 @@
return renderer_preferences_;
}
-WebContents* WebContentsImpl::GetAsWebContents() {
- return this;
-}
-
gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const {
if (delegate_)
return delegate_->GetRootWindowResizerRect();
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/content_shell.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698