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

Unified Diff: chrome/browser/guest_view/guest_view_manager.cc

Issue 264943006: BrowserPlugin: Simplify content/public API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_v1
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/guest_view/guest_view_manager.cc
diff --git a/chrome/browser/guest_view/guest_view_manager.cc b/chrome/browser/guest_view/guest_view_manager.cc
index 1e07de105f5ddc1d603123133d849f51eaef1862..b993e86aed3e3760c147ac38d818e3f297f63ecf 100644
--- a/chrome/browser/guest_view/guest_view_manager.cc
+++ b/chrome/browser/guest_view/guest_view_manager.cc
@@ -97,13 +97,33 @@ void GuestViewManager::RemoveGuest(int guest_instance_id) {
guest_web_contents_by_instance_id_.erase(it);
}
-content::WebContents* GuestViewManager::GetGuestByInstanceID(
+void GuestViewManager::MaybeGetGuestByInstanceIDOrKill(
+ int guest_instance_id,
+ int embedder_render_process_id,
+ const GuestByInstanceIDCallback& callback) {
+ if (!CanEmbedderAccessInstanceIDMaybeKill(embedder_render_process_id,
+ guest_instance_id)) {
+ // If we kill the embedder, then don't bother calling back.
+ return;
+ }
+ content::WebContents* guest_web_contents =
+ GetGuestByInstanceID(guest_instance_id, embedder_render_process_id);
+ callback.Run(guest_web_contents);
+}
+
+content::WebContents* GuestViewManager::GetGuestByInstanceIDSafely(
int guest_instance_id,
int embedder_render_process_id) {
if (!CanEmbedderAccessInstanceIDMaybeKill(embedder_render_process_id,
guest_instance_id)) {
return NULL;
}
+ return GetGuestByInstanceID(guest_instance_id, embedder_render_process_id);
+}
+
+content::WebContents* GuestViewManager::GetGuestByInstanceID(
lazyboy 2014/05/01 23:27:58 Rearrange placement of this function so it matches
Fady Samuel 2014/05/06 16:51:36 Done.
+ int guest_instance_id,
+ int embedder_render_process_id) {
GuestInstanceMap::const_iterator it =
guest_web_contents_by_instance_id_.find(guest_instance_id);
if (it == guest_web_contents_by_instance_id_.end())

Powered by Google App Engine
This is Rietveld 408576698