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

Unified Diff: extensions/browser/guest_view/guest_view_manager.h

Issue 444813002: Remove BrowserPlugin's -internal-attach method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't crash on tear down Created 6 years, 4 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: extensions/browser/guest_view/guest_view_manager.h
diff --git a/extensions/browser/guest_view/guest_view_manager.h b/extensions/browser/guest_view/guest_view_manager.h
index 44f4249a9babddf371474e1cbdf76236ad21d7bf..a82aebc035f5c5a99ca2060553edf6b12ef54e12 100644
--- a/extensions/browser/guest_view/guest_view_manager.h
+++ b/extensions/browser/guest_view/guest_view_manager.h
@@ -47,7 +47,20 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
int guest_instance_id,
int embedder_render_process_id);
+ // Associates the Browser Plugin with |element_instance_id| to a
+ // guest that has ID of |guest_instance_id| and sets initialization
+ // parameters, |params| for it.
+ void AttachGuest(int embedder_render_process_id,
+ int embedder_routing_id,
+ int element_instance_id,
+ int guest_instance_id,
+ const base::DictionaryValue& attach_params);
+
int GetNextInstanceID();
+ int GetGuestInstanceIDForPluginID(
+ content::WebContents* embedder_web_contents,
+ int element_instance_id);
+
typedef base::Callback<void(content::WebContents*)>
WebContentsCreatedCallback;
@@ -68,12 +81,11 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
// BrowserPluginGuestManager implementation.
virtual void MaybeGetGuestByInstanceIDOrKill(
- int guest_instance_id,
- int embedder_render_process_id,
+ content::WebContents* embedder_web_contents,
+ int element_instance_id,
const GuestByInstanceIDCallback& callback) OVERRIDE;
virtual bool ForEachGuest(content::WebContents* embedder_web_contents,
const GuestCallback& callback) OVERRIDE;
-
protected:
friend class GuestViewBase;
FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove);
@@ -106,6 +118,26 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
typedef std::map<int, content::WebContents*> GuestInstanceMap;
GuestInstanceMap guest_web_contents_by_instance_id_;
+ struct ElementInstanceKey {
+ content::WebContents* embedder_web_contents;
+ int element_instance_id;
+ ElementInstanceKey(content::WebContents* embedder_web_contents,
+ int element_instance_id)
+ : embedder_web_contents(embedder_web_contents),
+ element_instance_id(element_instance_id) {}
+ bool operator<(const ElementInstanceKey& other) const {
+ if (embedder_web_contents != other.embedder_web_contents)
+ return embedder_web_contents < other.embedder_web_contents;
+ return element_instance_id < other.element_instance_id;
+ }
+ };
+
+ typedef std::map<ElementInstanceKey, int> GuestInstanceIDMap;
+ GuestInstanceIDMap instance_id_map_;
+ // The reverse map of GuestInstanceIDMap.
+ typedef std::map<int, ElementInstanceKey> GuestInstanceIDReverseMap;
+ GuestInstanceIDReverseMap reverse_instance_id_map_;
+
int current_instance_id_;
// Any instance ID whose number not greater than this was removed via
« no previous file with comments | « extensions/browser/guest_view/guest_view_base.cc ('k') | extensions/browser/guest_view/guest_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698