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" | |
| 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 // TODO(fsamuel): This is a non-trivial accessor because it converts a |
|
Charlie Reis
2014/09/09 21:22:14
I guess I'm missing the relevant detail-- how does
Charlie Reis
2014/09/10 00:28:21
One part of my question was about the TODO, which
Fady Samuel
2014/09/10 02:51:37
Done.
Fady Samuel
2014/09/10 02:51:37
Done.
| |
| 132 // WebContentsImpl into a WebContents. We should rename this and move the | |
| 133 // implementation to the cc file. | |
| 134 WebContents* embedder_web_contents() const { | |
| 131 return embedder_web_contents_; | 135 return embedder_web_contents_; |
| 132 } | 136 } |
| 133 | 137 |
| 134 // Returns the embedder's RenderWidgetHostView if it is available. | 138 // Returns the embedder's RenderWidgetHostView if it is available. |
| 135 // Returns NULL otherwise. | 139 // Returns NULL otherwise. |
| 136 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); | 140 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); |
| 137 | 141 |
| 138 bool focused() const { return focused_; } | 142 bool focused() const { return focused_; } |
| 139 bool visible() const { return guest_visible_; } | 143 bool visible() const { return guest_visible_; } |
| 140 bool is_in_destruction() { return is_in_destruction_; } | 144 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); | 242 const gfx::Point& location); |
| 239 // Instructs the guest to execute an edit command decoded in the embedder. | 243 // Instructs the guest to execute an edit command decoded in the embedder. |
| 240 void OnExecuteEditCommand(int instance_id, | 244 void OnExecuteEditCommand(int instance_id, |
| 241 const std::string& command); | 245 const std::string& command); |
| 242 | 246 |
| 243 // Returns compositor resources reclaimed in the embedder to the guest. | 247 // Returns compositor resources reclaimed in the embedder to the guest. |
| 244 void OnReclaimCompositorResources( | 248 void OnReclaimCompositorResources( |
| 245 int instance_id, | 249 int instance_id, |
| 246 const FrameHostMsg_ReclaimCompositorResources_Params& params); | 250 const FrameHostMsg_ReclaimCompositorResources_Params& params); |
| 247 | 251 |
| 248 void OnHandleInputEvent(int instance_id, | |
| 249 const gfx::Rect& guest_window_rect, | |
| 250 const blink::WebInputEvent* event); | |
| 251 void OnLockMouse(bool user_gesture, | 252 void OnLockMouse(bool user_gesture, |
| 252 bool last_unlocked_by_target, | 253 bool last_unlocked_by_target, |
| 253 bool privileged); | 254 bool privileged); |
| 254 void OnLockMouseAck(int instance_id, bool succeeded); | 255 void OnLockMouseAck(int instance_id, bool succeeded); |
| 255 void OnPluginDestroyed(int instance_id); | 256 void OnPluginDestroyed(int instance_id); |
| 256 // Resizes the guest's web contents. | 257 // Resizes the guest's web contents. |
| 257 void OnResizeGuest( | 258 void OnResizeGuest( |
| 258 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); | 259 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| 259 void OnSetFocus(int instance_id, bool focused); | 260 void OnSetFocus(int instance_id, bool focused); |
| 260 // Sets the name of the guest so that other guests in the same partition can | 261 // 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 | 379 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 379 // permission. | 380 // permission. |
| 380 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 381 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 381 | 382 |
| 382 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 383 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 383 }; | 384 }; |
| 384 | 385 |
| 385 } // namespace content | 386 } // namespace content |
| 386 | 387 |
| 387 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 388 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |