OLD | NEW |
---|---|
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 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 | 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 | 62 // attached to a |guest_opener|, and may be attached to a pre-selected |
63 // |routing_id|. | 63 // |routing_id|. |
Charlie Reis
2013/01/18 05:36:45
Please update this comment to say that it does the
Fady Samuel
2013/01/18 15:26:25
Done.
| |
64 void CreateGuest(int instance_id, | 64 void CreateGuest(int instance_id, |
65 int routing_id, | 65 int routing_id, |
66 BrowserPluginGuest* guest_opener, | 66 BrowserPluginGuest* guest_opener, |
67 const BrowserPluginHostMsg_CreateGuest_Params& params); | 67 const BrowserPluginHostMsg_CreateGuest_Params& params); |
68 | 68 |
69 // Returns a guest browser plugin delegate by its container ID specified | 69 // Returns a guest browser plugin delegate by its container ID specified |
70 // in BrowserPlugin. | 70 // in BrowserPlugin. |
71 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const; | 71 BrowserPluginGuest* GetGuestByInstanceID(int instance_id) const; |
72 | 72 |
73 // Destroy the guest with the provided |instance_id|. Remove references to the | 73 // Destroy the guest with the provided |instance_id|. Remove references to the |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 void CleanUp(); | 111 void CleanUp(); |
112 | 112 |
113 // Called when visiblity of web_contents changes, so the embedder will | 113 // Called when visiblity of web_contents changes, so the embedder will |
114 // show/hide its guest. | 114 // show/hide its guest. |
115 void WebContentsVisibilityChanged(bool visible); | 115 void WebContentsVisibilityChanged(bool visible); |
116 | 116 |
117 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message); | 117 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message); |
118 | 118 |
119 // Message handlers. | 119 // Message handlers. |
120 | 120 |
121 void OnAllocateInstanceID(int request_id); | |
121 void OnCreateGuest(int instance_id, | 122 void OnCreateGuest(int instance_id, |
122 const BrowserPluginHostMsg_CreateGuest_Params& params); | 123 const BrowserPluginHostMsg_CreateGuest_Params& params); |
123 void OnPluginAtPositionResponse(int instance_id, | 124 void OnPluginAtPositionResponse(int instance_id, |
124 int request_id, | 125 int request_id, |
125 const gfx::Point& position); | 126 const gfx::Point& position); |
126 void OnPluginDestroyed(int instance_id); | 127 void OnPluginDestroyed(int instance_id); |
127 void OnSwapBuffersACK(int route_id, | 128 void OnSwapBuffersACK(int route_id, |
128 int gpu_host_id, | 129 int gpu_host_id, |
129 const std::string& mailbox_name, | 130 const std::string& mailbox_name, |
130 uint32 sync_point); | 131 uint32 sync_point); |
(...skipping 10 matching lines...) Expand all Loading... | |
141 // Tracks the visibility state of the embedder. | 142 // Tracks the visibility state of the embedder. |
142 bool visible_; | 143 bool visible_; |
143 // Map that contains outstanding queries to |GetBrowserPluginAt|. | 144 // Map that contains outstanding queries to |GetBrowserPluginAt|. |
144 // We need a roundtrip to renderer process to know the answer, therefore | 145 // We need a roundtrip to renderer process to know the answer, therefore |
145 // storing these callbacks is required. | 146 // storing these callbacks is required. |
146 typedef std::map<int, WebContents::GetRenderViewHostCallback> | 147 typedef std::map<int, WebContents::GetRenderViewHostCallback> |
147 GetRenderViewHostCallbackMap; | 148 GetRenderViewHostCallbackMap; |
148 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_; | 149 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_; |
149 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query. | 150 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query. |
150 int next_get_render_view_request_id_; | 151 int next_get_render_view_request_id_; |
152 int next_instance_id_; | |
151 | 153 |
152 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 154 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
153 }; | 155 }; |
154 | 156 |
155 } // namespace content | 157 } // namespace content |
156 | 158 |
157 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 159 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |