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

Side by Side Diff: components/guest_view/browser/guest_view_message_filter.cc

Issue 2848723002: Use a weak pointer when binding GuestViewBase::DidAttach. (Closed)
Patch Set: Created 3 years, 7 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 | « components/guest_view/browser/guest_view_message_filter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/guest_view/browser/guest_view_message_filter.h" 5 #include "components/guest_view/browser/guest_view_message_filter.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "components/guest_view/browser/guest_view_base.h" 8 #include "components/guest_view/browser/guest_view_base.h"
9 #include "components/guest_view/browser/guest_view_manager.h" 9 #include "components/guest_view/browser/guest_view_manager.h"
10 #include "components/guest_view/browser/guest_view_manager_delegate.h" 10 #include "components/guest_view/browser/guest_view_manager_delegate.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // This sets up the embedder and guest pairing information inside 137 // This sets up the embedder and guest pairing information inside
138 // the manager. 138 // the manager.
139 manager->AttachGuest(render_process_id_, element_instance_id, 139 manager->AttachGuest(render_process_id_, element_instance_id,
140 guest_instance_id, params); 140 guest_instance_id, params);
141 141
142 owner_web_contents->GetMainFrame()->Send( 142 owner_web_contents->GetMainFrame()->Send(
143 new GuestViewMsg_AttachToEmbedderFrame_ACK(element_instance_id)); 143 new GuestViewMsg_AttachToEmbedderFrame_ACK(element_instance_id));
144 144
145 guest->WillAttach( 145 guest->WillAttach(
146 owner_web_contents, element_instance_id, false, 146 owner_web_contents, element_instance_id, false,
147 base::Bind(&GuestViewMessageFilter::WillAttachCallback, this, guest)); 147 base::Bind(&GuestViewBase::DidAttach,
148 guest->weak_ptr_factory_.GetWeakPtr(), MSG_ROUTING_NONE));
148 149
149 // Attach this inner WebContents |guest_web_contents| to the outer 150 // Attach this inner WebContents |guest_web_contents| to the outer
150 // WebContents |owner_web_contents|. The outer WebContents's 151 // WebContents |owner_web_contents|. The outer WebContents's
151 // frame |embedder_frame| hosts the inner WebContents. 152 // frame |embedder_frame| hosts the inner WebContents.
152 // NOTE: this must be called last, because it could unblock pending requests 153 // NOTE: this must be called last, because it could unblock pending requests
153 // which depend on the WebViewGuest being initialized which happens above. 154 // which depend on the WebViewGuest being initialized which happens above.
154 guest_web_contents->AttachToOuterWebContentsFrame(owner_web_contents, 155 guest_web_contents->AttachToOuterWebContentsFrame(owner_web_contents,
155 embedder_frame); 156 embedder_frame);
156 } 157 }
157 158
158 void GuestViewMessageFilter::WillAttachCallback(GuestViewBase* guest) {
159 guest->DidAttach(MSG_ROUTING_NONE);
160 }
161
162 } // namespace guest_view 159 } // namespace guest_view
OLDNEW
« no previous file with comments | « components/guest_view/browser/guest_view_message_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698