Chromium Code Reviews| 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. Any | 9 // BrowserPluginGuest lives on the UI thread of the browser process. Any |
| 10 // messages about the guest render process that the embedder might be interested | 10 // messages about the guest render process that the embedder might be interested |
| 11 // in receiving should be listened for here. | 11 // in receiving should be listened for here. |
| 12 // | 12 // |
| 13 // BrowserPluginGuest is a WebContentsObserver for the guest WebContents. | 13 // BrowserPluginGuest is a WebContentsObserver for the guest WebContents. |
| 14 // BrowserPluginGuest operates under the assumption that the guest will be | 14 // BrowserPluginGuest operates under the assumption that the guest will be |
| 15 // accessible through only one RenderViewHost for the lifetime of | 15 // accessible through only one RenderViewHost for the lifetime of |
| 16 // the guest WebContents. Thus, cross-process navigation is not supported. | 16 // the guest WebContents. Thus, cross-process navigation is not supported. |
| 17 | 17 |
| 18 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 18 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| 19 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 19 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| 20 | 20 |
| 21 #include <map> | 21 #include <map> |
| 22 #include <queue> | 22 #include <queue> |
| 23 | 23 |
| 24 #include "base/compiler_specific.h" | 24 #include "base/compiler_specific.h" |
| 25 #include "base/memory/linked_ptr.h" | 25 #include "base/memory/linked_ptr.h" |
| 26 #include "base/memory/weak_ptr.h" | 26 #include "base/memory/weak_ptr.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "content/browser/web_contents/web_contents_impl.h" | |
|
lazyboy
2014/09/08 20:30:49
Why is this required here?
Fady Samuel
2014/09/08 20:46:23
To convert "embedder_web_contents_" to a WebConten
lazyboy
2014/09/08 20:53:19
I'd move embedder_web_contents() to browser_plugin
Fady Samuel
2014/09/09 14:58:17
Technically I should also be renaming this to GetE
lazyboy
2014/09/09 15:24:04
Sure, I'd put a todo here then.
| |
| 28 #include "content/common/edit_command.h" | 29 #include "content/common/edit_command.h" |
| 29 #include "content/common/input/input_event_ack_state.h" | 30 #include "content/common/input/input_event_ack_state.h" |
| 30 #include "content/public/browser/browser_plugin_guest_delegate.h" | 31 #include "content/public/browser/browser_plugin_guest_delegate.h" |
| 31 #include "content/public/browser/web_contents_observer.h" | 32 #include "content/public/browser/web_contents_observer.h" |
| 32 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 33 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| 33 #include "third_party/WebKit/public/web/WebDragOperation.h" | 34 #include "third_party/WebKit/public/web/WebDragOperation.h" |
| 34 #include "third_party/WebKit/public/web/WebDragStatus.h" | 35 #include "third_party/WebKit/public/web/WebDragStatus.h" |
| 35 #include "third_party/WebKit/public/web/WebInputEvent.h" | 36 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 36 #include "ui/base/ime/text_input_mode.h" | 37 #include "ui/base/ime/text_input_mode.h" |
| 37 #include "ui/base/ime/text_input_type.h" | 38 #include "ui/base/ime/text_input_type.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 // as the |opener|. | 121 // as the |opener|. |
| 121 WebContentsImpl* CreateNewGuestWindow( | 122 WebContentsImpl* CreateNewGuestWindow( |
| 122 const WebContents::CreateParams& params); | 123 const WebContents::CreateParams& params); |
| 123 | 124 |
| 124 // Returns the identifier that uniquely identifies a browser plugin guest | 125 // Returns the identifier that uniquely identifies a browser plugin guest |
| 125 // within an embedder. | 126 // within an embedder. |
| 126 int browser_plugin_instance_id() const { return browser_plugin_instance_id_; } | 127 int browser_plugin_instance_id() const { return browser_plugin_instance_id_; } |
| 127 | 128 |
| 128 bool OnMessageReceivedFromEmbedder(const IPC::Message& message); | 129 bool OnMessageReceivedFromEmbedder(const IPC::Message& message); |
| 129 | 130 |
| 130 WebContentsImpl* embedder_web_contents() const { | 131 WebContents* embedder_web_contents() const { |
| 131 return embedder_web_contents_; | 132 return embedder_web_contents_; |
| 132 } | 133 } |
| 133 | 134 |
| 134 // Returns the embedder's RenderWidgetHostView if it is available. | 135 // Returns the embedder's RenderWidgetHostView if it is available. |
| 135 // Returns NULL otherwise. | 136 // Returns NULL otherwise. |
| 136 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); | 137 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); |
| 137 | 138 |
| 138 bool focused() const { return focused_; } | 139 bool focused() const { return focused_; } |
| 139 bool visible() const { return guest_visible_; } | 140 bool visible() const { return guest_visible_; } |
| 140 bool is_in_destruction() { return is_in_destruction_; } | 141 bool is_in_destruction() { return is_in_destruction_; } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 const gfx::Point& location); | 239 const gfx::Point& location); |
| 239 // Instructs the guest to execute an edit command decoded in the embedder. | 240 // Instructs the guest to execute an edit command decoded in the embedder. |
| 240 void OnExecuteEditCommand(int instance_id, | 241 void OnExecuteEditCommand(int instance_id, |
| 241 const std::string& command); | 242 const std::string& command); |
| 242 | 243 |
| 243 // Returns compositor resources reclaimed in the embedder to the guest. | 244 // Returns compositor resources reclaimed in the embedder to the guest. |
| 244 void OnReclaimCompositorResources( | 245 void OnReclaimCompositorResources( |
| 245 int instance_id, | 246 int instance_id, |
| 246 const FrameHostMsg_ReclaimCompositorResources_Params& params); | 247 const FrameHostMsg_ReclaimCompositorResources_Params& params); |
| 247 | 248 |
| 248 void OnHandleInputEvent(int instance_id, | |
| 249 const gfx::Rect& guest_window_rect, | |
| 250 const blink::WebInputEvent* event); | |
| 251 void OnLockMouse(bool user_gesture, | 249 void OnLockMouse(bool user_gesture, |
| 252 bool last_unlocked_by_target, | 250 bool last_unlocked_by_target, |
| 253 bool privileged); | 251 bool privileged); |
| 254 void OnLockMouseAck(int instance_id, bool succeeded); | 252 void OnLockMouseAck(int instance_id, bool succeeded); |
| 255 void OnPluginDestroyed(int instance_id); | 253 void OnPluginDestroyed(int instance_id); |
| 256 // Resizes the guest's web contents. | 254 // Resizes the guest's web contents. |
| 257 void OnResizeGuest( | 255 void OnResizeGuest( |
| 258 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); | 256 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| 259 void OnSetFocus(int instance_id, bool focused); | 257 void OnSetFocus(int instance_id, bool focused); |
| 260 // Sets the name of the guest so that other guests in the same partition can | 258 // Sets the name of the guest so that other guests in the same partition can |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 376 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 379 // permission. | 377 // permission. |
| 380 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 378 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 381 | 379 |
| 382 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 380 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 383 }; | 381 }; |
| 384 | 382 |
| 385 } // namespace content | 383 } // namespace content |
| 386 | 384 |
| 387 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 385 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |