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

Side by Side Diff: chrome/browser/guest_view/guest_view_manager.cc

Issue 272573005: <webview>: Move NewWindow API to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_rename
Patch Set: Merge with ToT Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/guest_view/guest_view_manager.h" 5 #include "chrome/browser/guest_view/guest_view_manager.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/guest_view/guest_view_base.h" 9 #include "chrome/browser/guest_view/guest_view_base.h"
10 #include "chrome/browser/guest_view/guest_view_constants.h" 10 #include "chrome/browser/guest_view/guest_view_constants.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 return NULL; 172 return NULL;
173 } 173 }
174 174
175 bool GuestViewManager::ForEachGuest(WebContents* embedder_web_contents, 175 bool GuestViewManager::ForEachGuest(WebContents* embedder_web_contents,
176 const GuestCallback& callback) { 176 const GuestCallback& callback) {
177 for (GuestInstanceMap::iterator it = 177 for (GuestInstanceMap::iterator it =
178 guest_web_contents_by_instance_id_.begin(); 178 guest_web_contents_by_instance_id_.begin();
179 it != guest_web_contents_by_instance_id_.end(); ++it) { 179 it != guest_web_contents_by_instance_id_.end(); ++it) {
180 WebContents* guest = it->second; 180 WebContents* guest = it->second;
181 if (embedder_web_contents != guest->GetEmbedderWebContents()) 181 GuestViewBase* guest_view = GuestViewBase::FromWebContents(guest);
182 if (embedder_web_contents != guest_view->embedder_web_contents())
182 continue; 183 continue;
183 184
184 if (callback.Run(guest)) 185 if (callback.Run(guest))
185 return true; 186 return true;
186 } 187 }
187 return false; 188 return false;
188 } 189 }
189 190
190 void GuestViewManager::AddGuest(int guest_instance_id, 191 void GuestViewManager::AddGuest(int guest_instance_id,
191 WebContents* guest_web_contents) { 192 WebContents* guest_web_contents) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 266
266 bool GuestViewManager::CanEmbedderAccessGuest(int embedder_render_process_id, 267 bool GuestViewManager::CanEmbedderAccessGuest(int embedder_render_process_id,
267 GuestViewBase* guest) { 268 GuestViewBase* guest) {
268 // The embedder can access the guest if it has not been attached and its 269 // The embedder can access the guest if it has not been attached and its
269 // opener's embedder lives in the same process as the given embedder. 270 // opener's embedder lives in the same process as the given embedder.
270 if (!guest->attached()) { 271 if (!guest->attached()) {
271 if (!guest->GetOpener()) 272 if (!guest->GetOpener())
272 return false; 273 return false;
273 274
274 return embedder_render_process_id == 275 return embedder_render_process_id ==
275 guest->GetOpener()->GetEmbedderWebContents()->GetRenderProcessHost()-> 276 guest->GetOpener()->embedder_web_contents()->GetRenderProcessHost()->
276 GetID(); 277 GetID();
277 } 278 }
278 279
279 return embedder_render_process_id == 280 return embedder_render_process_id ==
280 guest->embedder_web_contents()->GetRenderProcessHost()->GetID(); 281 guest->embedder_web_contents()->GetRenderProcessHost()->GetID();
281 } 282 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/guest_view_base.cc ('k') | chrome/browser/guest_view/web_view/javascript_dialog_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698