| 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 <stdint.h> | 21 #include <stdint.h> |
| 22 | 22 |
| 23 #include <map> | 23 #include <map> |
| 24 #include <memory> |
| 24 #include <queue> | 25 #include <queue> |
| 25 | 26 |
| 26 #include "base/compiler_specific.h" | 27 #include "base/compiler_specific.h" |
| 27 #include "base/macros.h" | 28 #include "base/macros.h" |
| 28 #include "base/memory/linked_ptr.h" | |
| 29 #include "base/memory/weak_ptr.h" | 29 #include "base/memory/weak_ptr.h" |
| 30 #include "base/values.h" | 30 #include "base/values.h" |
| 31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
| 32 #include "content/common/edit_command.h" | 32 #include "content/common/edit_command.h" |
| 33 #include "content/common/input/input_event_ack_state.h" | 33 #include "content/common/input/input_event_ack_state.h" |
| 34 #include "content/public/browser/browser_plugin_guest_delegate.h" | 34 #include "content/public/browser/browser_plugin_guest_delegate.h" |
| 35 #include "content/public/browser/guest_host.h" | 35 #include "content/public/browser/guest_host.h" |
| 36 #include "content/public/browser/readback_types.h" | 36 #include "content/public/browser/readback_types.h" |
| 37 #include "content/public/browser/web_contents_observer.h" | 37 #include "content/public/browser/web_contents_observer.h" |
| 38 #include "third_party/WebKit/public/platform/WebDragOperation.h" | 38 #include "third_party/WebKit/public/platform/WebDragOperation.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // the BrowserPlugin are modified by any CSS transforms applied on the plugin. | 195 // the BrowserPlugin are modified by any CSS transforms applied on the plugin. |
| 196 // Therefore, the coordinates of the context menu event with respect to the | 196 // Therefore, the coordinates of the context menu event with respect to the |
| 197 // container window are modifed with the guest renderer process beiung unaware | 197 // container window are modifed with the guest renderer process beiung unaware |
| 198 // of the change. Then eventually, when the context menu event arrives at the | 198 // of the change. Then eventually, when the context menu event arrives at the |
| 199 // browser, it contains the wrong coordinates (BUG=470087). | 199 // browser, it contains the wrong coordinates (BUG=470087). |
| 200 // TODO(ekaramad): Find a more fundamental solution and remove this later. | 200 // TODO(ekaramad): Find a more fundamental solution and remove this later. |
| 201 void SetContextMenuPosition(const gfx::Point& position); | 201 void SetContextMenuPosition(const gfx::Point& position); |
| 202 | 202 |
| 203 // Helper to send messages to embedder. If this guest is not yet attached, | 203 // Helper to send messages to embedder. If this guest is not yet attached, |
| 204 // then IPCs will be queued until attachment. | 204 // then IPCs will be queued until attachment. |
| 205 void SendMessageToEmbedder(IPC::Message* msg); | 205 void SendMessageToEmbedder(std::unique_ptr<IPC::Message> msg); |
| 206 | 206 |
| 207 // Returns whether the guest is attached to an embedder. | 207 // Returns whether the guest is attached to an embedder. |
| 208 bool attached() const { return attached_; } | 208 bool attached() const { return attached_; } |
| 209 | 209 |
| 210 // Returns true when an attachment has taken place since the last time the | 210 // Returns true when an attachment has taken place since the last time the |
| 211 // compositor surface was set. | 211 // compositor surface was set. |
| 212 bool has_attached_since_surface_set() const { | 212 bool has_attached_since_surface_set() const { |
| 213 return has_attached_since_surface_set_; | 213 return has_attached_since_surface_set_; |
| 214 } | 214 } |
| 215 | 215 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 const std::string& name); | 374 const std::string& name); |
| 375 | 375 |
| 376 // Called when WillAttach is complete. | 376 // Called when WillAttach is complete. |
| 377 void OnWillAttachComplete(WebContentsImpl* embedder_web_contents, | 377 void OnWillAttachComplete(WebContentsImpl* embedder_web_contents, |
| 378 const BrowserPluginHostMsg_Attach_Params& params); | 378 const BrowserPluginHostMsg_Attach_Params& params); |
| 379 | 379 |
| 380 // Returns identical message with current browser_plugin_instance_id() if | 380 // Returns identical message with current browser_plugin_instance_id() if |
| 381 // the input was created with browser_plugin::kInstanceIdNone, else it returns | 381 // the input was created with browser_plugin::kInstanceIdNone, else it returns |
| 382 // the input message unmodified. If no current browser_plugin_instance_id() | 382 // the input message unmodified. If no current browser_plugin_instance_id() |
| 383 // is set, or anything goes wrong, the input message is returned. | 383 // is set, or anything goes wrong, the input message is returned. |
| 384 IPC::Message* UpdateInstanceIdIfNecessary(IPC::Message* msg) const; | 384 std::unique_ptr<IPC::Message> UpdateInstanceIdIfNecessary( |
| 385 std::unique_ptr<IPC::Message> msg) const; |
| 385 | 386 |
| 386 // Forwards all messages from the |pending_messages_| queue to the embedder. | 387 // Forwards all messages from the |pending_messages_| queue to the embedder. |
| 387 void SendQueuedMessages(); | 388 void SendQueuedMessages(); |
| 388 | 389 |
| 389 void SendTextInputTypeChangedToView(RenderWidgetHostViewBase* guest_rwhv); | 390 void SendTextInputTypeChangedToView(RenderWidgetHostViewBase* guest_rwhv); |
| 390 | 391 |
| 391 // The last tooltip that was set with SetTooltipText(). | 392 // The last tooltip that was set with SetTooltipText(). |
| 392 base::string16 current_tooltip_text_; | 393 base::string16 current_tooltip_text_; |
| 393 | 394 |
| 394 std::unique_ptr<EmbedderVisibilityObserver> embedder_visibility_observer_; | 395 std::unique_ptr<EmbedderVisibilityObserver> embedder_visibility_observer_; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // Whether or not our embedder has seen a SystemDragEnded() call. | 441 // Whether or not our embedder has seen a SystemDragEnded() call. |
| 441 bool seen_embedder_system_drag_ended_; | 442 bool seen_embedder_system_drag_ended_; |
| 442 // Whether or not our embedder has seen a DragSourceEndedAt() call. | 443 // Whether or not our embedder has seen a DragSourceEndedAt() call. |
| 443 bool seen_embedder_drag_source_ended_at_; | 444 bool seen_embedder_drag_source_ended_at_; |
| 444 | 445 |
| 445 // Ignore the URL dragged into guest that is coming from guest. | 446 // Ignore the URL dragged into guest that is coming from guest. |
| 446 bool ignore_dragged_url_; | 447 bool ignore_dragged_url_; |
| 447 | 448 |
| 448 // This is a queue of messages that are destined to be sent to the embedder | 449 // This is a queue of messages that are destined to be sent to the embedder |
| 449 // once the guest is attached to a particular embedder. | 450 // once the guest is attached to a particular embedder. |
| 450 std::deque<linked_ptr<IPC::Message> > pending_messages_; | 451 std::deque<std::unique_ptr<IPC::Message>> pending_messages_; |
| 451 | 452 |
| 452 BrowserPluginGuestDelegate* const delegate_; | 453 BrowserPluginGuestDelegate* const delegate_; |
| 453 | 454 |
| 454 // Whether or not this BrowserPluginGuest can use cross process frames. This | 455 // Whether or not this BrowserPluginGuest can use cross process frames. This |
| 455 // means when we have --use-cross-process-frames-for-guests on, the | 456 // means when we have --use-cross-process-frames-for-guests on, the |
| 456 // WebContents associated with this BrowserPluginGuest has OOPIF structure. | 457 // WebContents associated with this BrowserPluginGuest has OOPIF structure. |
| 457 bool can_use_cross_process_frames_; | 458 bool can_use_cross_process_frames_; |
| 458 | 459 |
| 459 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 460 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 460 // permission. | 461 // permission. |
| 461 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 462 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 462 | 463 |
| 463 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 464 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 464 }; | 465 }; |
| 465 | 466 |
| 466 } // namespace content | 467 } // namespace content |
| 467 | 468 |
| 468 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 469 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |