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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_embedder.h

Issue 11748034: Browser Plugin: Refactor BrowserPluginEmbedder to allow creating guests with openers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // A BrowserPluginEmbedder has a list of guests it manages. 5 // A BrowserPluginEmbedder has a list of guests it manages.
6 // In the beginning when a renderer sees one or more guests (BrowserPlugin 6 // In the beginning when a renderer sees one or more guests (BrowserPlugin
7 // instance(s)) and there is a request to navigate to them, the WebContents for 7 // instance(s)) and there is a request to navigate to them, the WebContents for
8 // that renderer creates a BrowserPluginEmbedder for itself. The 8 // that renderer creates a BrowserPluginEmbedder for itself. The
9 // BrowserPluginEmbedder, in turn, manages a set of BrowserPluginGuests -- one 9 // BrowserPluginEmbedder, in turn, manages a set of BrowserPluginGuests -- one
10 // BrowserPluginGuest for each guest in the embedding WebContents. Note that 10 // BrowserPluginGuest for each guest in the embedding WebContents. Note that
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver, 50 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver,
51 public NotificationObserver { 51 public NotificationObserver {
52 public: 52 public:
53 typedef std::map<int, WebContents*> ContainerInstanceMap; 53 typedef std::map<int, WebContents*> ContainerInstanceMap;
54 54
55 virtual ~BrowserPluginEmbedder(); 55 virtual ~BrowserPluginEmbedder();
56 56
57 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents, 57 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents,
58 RenderViewHost* render_view_host); 58 RenderViewHost* render_view_host);
59 59
60 void CreateGuest(int instance_id,
sadrul 2013/01/07 15:09:54 Doc
Fady Samuel 2013/01/08 17:00:49 Done.
61 int routing_id,
62 BrowserPluginGuest* guest_opener,
63 const BrowserPluginHostMsg_CreateGuest_Params& params);
64
65 // Returns a guest browser plugin delegate by its container ID specified
66 // in BrowserPlugin.
67 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const;
68
69 // Destroy the guest with the provided |instance_id|. Remove references to the
70 // guest in this BrowserPluginEmbedder.
71 void DestroyGuestByInstanceID(int instance_id);
sadrul 2013/01/07 15:09:54 It doesn't look like either GuestGuestByInstanceID
Fady Samuel 2013/01/08 17:00:49 This will be used by follow-on patches. I am makin
72
60 // Overrides factory for testing. Default (NULL) value indicates regular 73 // Overrides factory for testing. Default (NULL) value indicates regular
61 // (non-test) environment. 74 // (non-test) environment.
62 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { 75 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
63 factory_ = factory; 76 factory_ = factory;
64 } 77 }
65 78
66 bool visible() const { return visible_; } 79 bool visible() const { return visible_; }
67 80
68 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via 81 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via
69 // |callback|. We need a roundtrip to renderer process to get this 82 // |callback|. We need a roundtrip to renderer process to get this
(...skipping 12 matching lines...) Expand all
82 virtual void Observe(int type, 95 virtual void Observe(int type,
83 const NotificationSource& source, 96 const NotificationSource& source,
84 const NotificationDetails& details) OVERRIDE; 97 const NotificationDetails& details) OVERRIDE;
85 98
86 private: 99 private:
87 friend class TestBrowserPluginEmbedder; 100 friend class TestBrowserPluginEmbedder;
88 101
89 BrowserPluginEmbedder(WebContentsImpl* web_contents, 102 BrowserPluginEmbedder(WebContentsImpl* web_contents,
90 RenderViewHost* render_view_host); 103 RenderViewHost* render_view_host);
91 104
92 // Returns a guest browser plugin delegate by its container ID specified
93 // in BrowserPlugin.
94 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const;
95 // Adds a new guest web_contents to the embedder (overridable in test). 105 // Adds a new guest web_contents to the embedder (overridable in test).
96 virtual void AddGuest(int instance_id, WebContents* guest_web_contents); 106 virtual void AddGuest(int instance_id, WebContents* guest_web_contents);
97 void DestroyGuestByInstanceID(int instance_id);
98 void CleanUp(); 107 void CleanUp();
99 108
100 // Called when visiblity of web_contents changes, so the embedder will 109 // Called when visiblity of web_contents changes, so the embedder will
101 // show/hide its guest. 110 // show/hide its guest.
102 void WebContentsVisibilityChanged(bool visible); 111 void WebContentsVisibilityChanged(bool visible);
103 112
104 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message); 113 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message);
105 114
106 // Message handlers. 115 // Message handlers.
107 116
(...skipping 28 matching lines...) Expand all
136 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_; 145 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_;
137 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query. 146 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query.
138 int next_get_render_view_request_id_; 147 int next_get_render_view_request_id_;
139 148
140 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); 149 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder);
141 }; 150 };
142 151
143 } // namespace content 152 } // namespace content
144 153
145 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ 154 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698