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

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: Fixed nits 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
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_embedder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Create a guest WebContents with the provided |instance_id| and |params| and
61 // add it to this BrowserPluginEmbedder. Optionally, the new guest may be
62 // attached to a |guest_opener|, and may be attached to a pre-selected
63 // |routing_id|.
64 void CreateGuest(int instance_id,
65 int routing_id,
66 BrowserPluginGuest* guest_opener,
67 const BrowserPluginHostMsg_CreateGuest_Params& params);
68
69 // Returns a guest browser plugin delegate by its container ID specified
70 // in BrowserPlugin.
71 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const;
72
73 // Destroy the guest with the provided |instance_id|. Remove references to the
74 // guest in this BrowserPluginEmbedder.
75 void DestroyGuestByInstanceID(int instance_id);
76
60 // Overrides factory for testing. Default (NULL) value indicates regular 77 // Overrides factory for testing. Default (NULL) value indicates regular
61 // (non-test) environment. 78 // (non-test) environment.
62 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { 79 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
63 factory_ = factory; 80 factory_ = factory;
64 } 81 }
65 82
66 bool visible() const { return visible_; } 83 bool visible() const { return visible_; }
67 84
68 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via 85 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via
69 // |callback|. We need a roundtrip to renderer process to get this 86 // |callback|. We need a roundtrip to renderer process to get this
(...skipping 12 matching lines...) Expand all
82 virtual void Observe(int type, 99 virtual void Observe(int type,
83 const NotificationSource& source, 100 const NotificationSource& source,
84 const NotificationDetails& details) OVERRIDE; 101 const NotificationDetails& details) OVERRIDE;
85 102
86 private: 103 private:
87 friend class TestBrowserPluginEmbedder; 104 friend class TestBrowserPluginEmbedder;
88 105
89 BrowserPluginEmbedder(WebContentsImpl* web_contents, 106 BrowserPluginEmbedder(WebContentsImpl* web_contents,
90 RenderViewHost* render_view_host); 107 RenderViewHost* render_view_host);
91 108
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). 109 // Adds a new guest web_contents to the embedder (overridable in test).
96 virtual void AddGuest(int instance_id, WebContents* guest_web_contents); 110 virtual void AddGuest(int instance_id, WebContents* guest_web_contents);
97 void DestroyGuestByInstanceID(int instance_id);
98 void CleanUp(); 111 void CleanUp();
99 112
100 // Called when visiblity of web_contents changes, so the embedder will 113 // Called when visiblity of web_contents changes, so the embedder will
101 // show/hide its guest. 114 // show/hide its guest.
102 void WebContentsVisibilityChanged(bool visible); 115 void WebContentsVisibilityChanged(bool visible);
103 116
104 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message); 117 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message);
105 118
106 // Message handlers. 119 // Message handlers.
107 120
(...skipping 28 matching lines...) Expand all
136 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_; 149 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_;
137 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query. 150 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query.
138 int next_get_render_view_request_id_; 151 int next_get_render_view_request_id_;
139 152
140 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); 153 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder);
141 }; 154 };
142 155
143 } // namespace content 156 } // namespace content
144 157
145 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ 158 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_embedder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698