| 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 |
| 11 // each of these BrowserPluginGuest objects has its own WebContents. | 11 // each of these BrowserPluginGuest objects has its own WebContents. |
| 12 // BrowserPluginEmbedder routes any messages directed to a guest from the | 12 // BrowserPluginEmbedder routes any messages directed to a guest from the |
| 13 // renderer (BrowserPlugin) to the appropriate guest (identified by the guest's | 13 // renderer (BrowserPlugin) to the appropriate guest (identified by the guest's |
| 14 // |instance_id|). | 14 // |instance_id|). |
| 15 // | 15 // |
| 16 // BrowserPluginEmbedder is responsible for cleaning up the guests when the | 16 // BrowserPluginEmbedder is responsible for cleaning up the guests when the |
| 17 // embedder frame navigates away to a different page or deletes the guests from | 17 // embedder frame navigates away to a different page or deletes the guests from |
| 18 // the existing page. | 18 // the existing page. |
| 19 | 19 |
| 20 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 20 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
| 21 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 21 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
| 22 | 22 |
| 23 #include <map> | 23 #include <map> |
| 24 | 24 |
| 25 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
| 26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/browser/web_contents_observer.h" | 29 #include "content/public/browser/web_contents_observer.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h" |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | |
| 32 #include "ui/surface/transport_dib.h" | 32 #include "ui/surface/transport_dib.h" |
| 33 #include "webkit/glue/webdropdata.h" | 33 #include "webkit/glue/webdropdata.h" |
| 34 | 34 |
| 35 struct BrowserPluginHostMsg_AutoSize_Params; | 35 struct BrowserPluginHostMsg_AutoSize_Params; |
| 36 struct BrowserPluginHostMsg_CreateGuest_Params; | 36 struct BrowserPluginHostMsg_CreateGuest_Params; |
| 37 struct BrowserPluginHostMsg_ResizeGuest_Params; | 37 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 38 | 38 |
| 39 namespace WebKit { | 39 namespace WebKit { |
| 40 class WebInputEvent; | 40 class WebInputEvent; |
| 41 } | 41 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 const WebDropData& drop_data, | 121 const WebDropData& drop_data, |
| 122 WebKit::WebDragOperationsMask drag_mask, | 122 WebKit::WebDragOperationsMask drag_mask, |
| 123 const gfx::Point& location); | 123 const gfx::Point& location); |
| 124 void SetAutoSize( | 124 void SetAutoSize( |
| 125 int instance_id, | 125 int instance_id, |
| 126 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, | 126 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, |
| 127 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); | 127 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); |
| 128 | 128 |
| 129 bool visible() const { return visible_; } | 129 bool visible() const { return visible_; } |
| 130 | 130 |
| 131 // Allows or denies a guest's media access request after the embedder has |
| 132 // decided. |
| 133 void AllowMediaAccess(int instance_id, int request_id, bool should_allow); |
| 134 |
| 131 // Overrides factory for testing. Default (NULL) value indicates regular | 135 // Overrides factory for testing. Default (NULL) value indicates regular |
| 132 // (non-test) environment. | 136 // (non-test) environment. |
| 133 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { | 137 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { |
| 134 factory_ = factory; | 138 factory_ = factory; |
| 135 } | 139 } |
| 136 | 140 |
| 137 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via | 141 // Returns the RenderViewHost at a point (|x|, |y|) asynchronously via |
| 138 // |callback|. We need a roundtrip to renderer process to get this | 142 // |callback|. We need a roundtrip to renderer process to get this |
| 139 // information. | 143 // information. |
| 140 void GetRenderViewHostAtPosition( | 144 void GetRenderViewHostAtPosition( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_; | 186 GetRenderViewHostCallbackMap pending_get_render_view_callbacks_; |
| 183 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query. | 187 // Next request id for BrowserPluginMsg_PluginAtPositionRequest query. |
| 184 int next_get_render_view_request_id_; | 188 int next_get_render_view_request_id_; |
| 185 | 189 |
| 186 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 190 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
| 187 }; | 191 }; |
| 188 | 192 |
| 189 } // namespace content | 193 } // namespace content |
| 190 | 194 |
| 191 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 195 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
| OLD | NEW |