| 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 BrowserPluginGuest is the browser side of a browser <--> embedder | 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder |
| 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder | 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder |
| 7 // renderer side of browser <--> embedder renderer communication. | 7 // renderer side of browser <--> embedder renderer communication. |
| 8 // | 8 // |
| 9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a | 9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a |
| 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The | 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 22 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| 23 | 23 |
| 24 #include <map> | 24 #include <map> |
| 25 #include <queue> | 25 #include <queue> |
| 26 | 26 |
| 27 #include "base/compiler_specific.h" | 27 #include "base/compiler_specific.h" |
| 28 #include "base/id_map.h" | 28 #include "base/id_map.h" |
| 29 #include "base/memory/shared_memory.h" | 29 #include "base/memory/shared_memory.h" |
| 30 #include "base/memory/weak_ptr.h" | 30 #include "base/memory/weak_ptr.h" |
| 31 #include "base/values.h" | 31 #include "base/values.h" |
| 32 #include "content/common/browser_plugin/browser_plugin_message_enums.h" | |
| 33 #include "content/common/edit_command.h" | 32 #include "content/common/edit_command.h" |
| 34 #include "content/port/common/input_event_ack_state.h" | 33 #include "content/port/common/input_event_ack_state.h" |
| 35 #include "content/public/browser/browser_plugin_guest_delegate.h" | 34 #include "content/public/browser/browser_plugin_guest_delegate.h" |
| 36 #include "content/public/browser/javascript_dialog_manager.h" | 35 #include "content/public/browser/javascript_dialog_manager.h" |
| 37 #include "content/public/browser/notification_observer.h" | 36 #include "content/public/browser/notification_observer.h" |
| 38 #include "content/public/browser/notification_registrar.h" | 37 #include "content/public/browser/notification_registrar.h" |
| 39 #include "content/public/browser/render_view_host_observer.h" | 38 #include "content/public/browser/render_view_host_observer.h" |
| 40 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
| 41 #include "content/public/browser/web_contents_observer.h" | 40 #include "content/public/browser/web_contents_observer.h" |
| 41 #include "content/public/common/browser_plugin_permission_type.h" |
| 42 #include "third_party/WebKit/public/web/WebDragOperation.h" | 42 #include "third_party/WebKit/public/web/WebDragOperation.h" |
| 43 #include "third_party/WebKit/public/web/WebDragStatus.h" | 43 #include "third_party/WebKit/public/web/WebDragStatus.h" |
| 44 #include "third_party/WebKit/public/web/WebInputEvent.h" | 44 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 45 #include "ui/gfx/rect.h" | 45 #include "ui/gfx/rect.h" |
| 46 #include "ui/surface/transport_dib.h" | 46 #include "ui/surface/transport_dib.h" |
| 47 | 47 |
| 48 struct BrowserPluginHostMsg_AutoSize_Params; | 48 struct BrowserPluginHostMsg_AutoSize_Params; |
| 49 struct BrowserPluginHostMsg_Attach_Params; | 49 struct BrowserPluginHostMsg_Attach_Params; |
| 50 struct BrowserPluginHostMsg_ResizeGuest_Params; | 50 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 51 struct ViewHostMsg_CreateWindow_Params; | 51 struct ViewHostMsg_CreateWindow_Params; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 void DragSourceMovedTo(int client_x, int client_y, | 276 void DragSourceMovedTo(int client_x, int client_y, |
| 277 int screen_x, int screen_y); | 277 int screen_x, int screen_y); |
| 278 | 278 |
| 279 // Called when the drag started by this guest ends at an OS-level. | 279 // Called when the drag started by this guest ends at an OS-level. |
| 280 void EndSystemDrag(); | 280 void EndSystemDrag(); |
| 281 | 281 |
| 282 // |this| takes ownership of |delegate|. | 282 // |this| takes ownership of |delegate|. |
| 283 void SetDelegate(BrowserPluginGuestDelegate* delegate); | 283 void SetDelegate(BrowserPluginGuestDelegate* delegate); |
| 284 | 284 |
| 285 void RespondToPermissionRequest(int request_id, |
| 286 bool should_allow, |
| 287 const std::string& user_input); |
| 288 |
| 285 private: | 289 private: |
| 286 class EmbedderRenderViewHostObserver; | 290 class EmbedderRenderViewHostObserver; |
| 287 friend class TestBrowserPluginGuest; | 291 friend class TestBrowserPluginGuest; |
| 288 | 292 |
| 289 class DownloadRequest; | 293 class DownloadRequest; |
| 290 class GeolocationRequest; | 294 class GeolocationRequest; |
| 291 class JavaScriptDialogRequest; | 295 class JavaScriptDialogRequest; |
| 292 // MediaRequest because of naming conflicts with MediaStreamRequest. | 296 // MediaRequest because of naming conflicts with MediaStreamRequest. |
| 293 class MediaRequest; | 297 class MediaRequest; |
| 294 class NewWindowRequest; | 298 class NewWindowRequest; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 bool user_gesture); | 336 bool user_gesture); |
| 333 | 337 |
| 334 // Message handlers for messages from embedder. | 338 // Message handlers for messages from embedder. |
| 335 | 339 |
| 336 void OnCompositorFrameACK(int instance_id, | 340 void OnCompositorFrameACK(int instance_id, |
| 337 int route_id, | 341 int route_id, |
| 338 uint32 output_surface_id, | 342 uint32 output_surface_id, |
| 339 int renderer_host_id, | 343 int renderer_host_id, |
| 340 const cc::CompositorFrameAck& ack); | 344 const cc::CompositorFrameAck& ack); |
| 341 | 345 |
| 342 // Allows or denies a permission request access, after the embedder has had a | |
| 343 // chance to decide. | |
| 344 void OnRespondPermission(int instance_id, | |
| 345 int request_id, | |
| 346 bool should_allow, | |
| 347 const std::string& user_input); | |
| 348 // Handles drag events from the embedder. | 346 // Handles drag events from the embedder. |
| 349 // When dragging, the drag events go to the embedder first, and if the drag | 347 // When dragging, the drag events go to the embedder first, and if the drag |
| 350 // happens on the browser plugin, then the plugin sends a corresponding | 348 // happens on the browser plugin, then the plugin sends a corresponding |
| 351 // drag-message to the guest. This routes the drag-message to the guest | 349 // drag-message to the guest. This routes the drag-message to the guest |
| 352 // renderer. | 350 // renderer. |
| 353 void OnDragStatusUpdate(int instance_id, | 351 void OnDragStatusUpdate(int instance_id, |
| 354 WebKit::WebDragStatus drag_status, | 352 WebKit::WebDragStatus drag_status, |
| 355 const DropData& drop_data, | 353 const DropData& drop_data, |
| 356 WebKit::WebDragOperationsMask drag_mask, | 354 WebKit::WebDragOperationsMask drag_mask, |
| 357 const gfx::Point& location); | 355 const gfx::Point& location); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 std::queue<IPC::Message*> pending_messages_; | 520 std::queue<IPC::Message*> pending_messages_; |
| 523 | 521 |
| 524 scoped_ptr<BrowserPluginGuestDelegate> delegate_; | 522 scoped_ptr<BrowserPluginGuestDelegate> delegate_; |
| 525 | 523 |
| 526 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 524 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 527 }; | 525 }; |
| 528 | 526 |
| 529 } // namespace content | 527 } // namespace content |
| 530 | 528 |
| 531 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 529 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |