| Index: content/browser/web_contents/web_contents_impl.cc
|
| ===================================================================
|
| --- content/browser/web_contents/web_contents_impl.cc (revision 240362)
|
| +++ content/browser/web_contents/web_contents_impl.cc (working copy)
|
| @@ -278,6 +278,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) {
|
| @@ -320,6 +333,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 {
|
| @@ -627,6 +647,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();
|
| }
|
| @@ -867,9 +897,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;
|
| }
|
|
|
| @@ -1641,10 +1671,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(
|
| @@ -2752,6 +2782,10 @@
|
| RenderFrameDeleted(render_frame_host));
|
| }
|
|
|
| +WebContents* WebContentsImpl::GetAsWebContents() {
|
| + return this;
|
| +}
|
| +
|
| RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() {
|
| return render_view_host_delegate_view_;
|
| }
|
| @@ -2766,10 +2800,6 @@
|
| return renderer_preferences_;
|
| }
|
|
|
| -WebContents* WebContentsImpl::GetAsWebContents() {
|
| - return this;
|
| -}
|
| -
|
| gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const {
|
| if (delegate_)
|
| return delegate_->GetRootWindowResizerRect();
|
|
|