| 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_observer.h" | 28 #include "content/public/browser/web_contents_observer.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
| 29 #include "ui/surface/transport_dib.h" | 31 #include "ui/surface/transport_dib.h" |
| 32 #include "webkit/glue/webdropdata.h" |
| 30 | 33 |
| 31 class WebContentsImpl; | 34 class WebContentsImpl; |
| 32 struct BrowserPluginHostMsg_ResizeGuest_Params; | 35 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 33 | 36 |
| 34 namespace WebKit { | 37 namespace WebKit { |
| 35 class WebInputEvent; | 38 class WebInputEvent; |
| 36 } | 39 } |
| 37 | 40 |
| 38 namespace gfx { | 41 namespace gfx { |
| 42 class Point; |
| 39 class Rect; | 43 class Rect; |
| 40 class Size; | 44 class Size; |
| 41 } | 45 } |
| 42 | 46 |
| 43 namespace content { | 47 namespace content { |
| 44 | 48 |
| 45 class BrowserPluginGuest; | 49 class BrowserPluginGuest; |
| 46 class BrowserPluginHostFactory; | 50 class BrowserPluginHostFactory; |
| 47 | 51 |
| 48 // A browser plugin embedder provides functionality for WebContents to operate | 52 // A browser plugin embedder provides functionality for WebContents to operate |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Handles input events sent from the BrowserPlugin (embedder's renderer | 104 // Handles input events sent from the BrowserPlugin (embedder's renderer |
| 101 // process) by passing them to appropriate guest's input handler. | 105 // process) by passing them to appropriate guest's input handler. |
| 102 void HandleInputEvent(int instance_id, | 106 void HandleInputEvent(int instance_id, |
| 103 RenderViewHost* render_view_host, | 107 RenderViewHost* render_view_host, |
| 104 const gfx::Rect& guest_rect, | 108 const gfx::Rect& guest_rect, |
| 105 const WebKit::WebInputEvent& event, | 109 const WebKit::WebInputEvent& event, |
| 106 IPC::Message* reply_message); | 110 IPC::Message* reply_message); |
| 107 void PluginDestroyed(int instance_id); | 111 void PluginDestroyed(int instance_id); |
| 108 void SetGuestVisibility(int instance_id, | 112 void SetGuestVisibility(int instance_id, |
| 109 bool guest_visible); | 113 bool guest_visible); |
| 114 void DragStatusUpdate(int instance_id, |
| 115 WebKit::WebDragStatus drag_status, |
| 116 const WebDropData& drop_data, |
| 117 WebKit::WebDragOperationsMask drag_mask, |
| 118 const gfx::Point& location); |
| 110 | 119 |
| 111 // Overrides factory for testing. Default (NULL) value indicates regular | 120 // Overrides factory for testing. Default (NULL) value indicates regular |
| 112 // (non-test) environment. | 121 // (non-test) environment. |
| 113 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { | 122 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { |
| 114 factory_ = factory; | 123 factory_ = factory; |
| 115 } | 124 } |
| 116 | 125 |
| 117 private: | 126 private: |
| 118 friend class TestBrowserPluginEmbedder; | 127 friend class TestBrowserPluginEmbedder; |
| 119 | 128 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 147 ContainerInstanceMap guest_web_contents_by_instance_id_; | 156 ContainerInstanceMap guest_web_contents_by_instance_id_; |
| 148 RenderViewHost* render_view_host_; | 157 RenderViewHost* render_view_host_; |
| 149 bool visible_; | 158 bool visible_; |
| 150 | 159 |
| 151 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 160 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
| 152 }; | 161 }; |
| 153 | 162 |
| 154 } // namespace content | 163 } // namespace content |
| 155 | 164 |
| 156 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 165 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
| OLD | NEW |