| 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "base/compiler_specific.h" | 26 #include "base/compiler_specific.h" |
| 27 #include "base/macros.h" | 27 #include "base/macros.h" |
| 28 #include "base/memory/linked_ptr.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/browser_plugin_guest_delegate_mode.h" |
| 35 #include "content/public/browser/guest_host.h" | 36 #include "content/public/browser/guest_host.h" |
| 36 #include "content/public/browser/readback_types.h" | 37 #include "content/public/browser/readback_types.h" |
| 37 #include "content/public/browser/web_contents_observer.h" | 38 #include "content/public/browser/web_contents_observer.h" |
| 38 #include "third_party/WebKit/public/platform/WebDragOperation.h" | 39 #include "third_party/WebKit/public/platform/WebDragOperation.h" |
| 39 #include "third_party/WebKit/public/platform/WebFocusType.h" | 40 #include "third_party/WebKit/public/platform/WebFocusType.h" |
| 40 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 41 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| 41 #include "third_party/WebKit/public/web/WebDragStatus.h" | 42 #include "third_party/WebKit/public/web/WebDragStatus.h" |
| 42 #include "third_party/WebKit/public/web/WebInputEvent.h" | 43 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 43 #include "ui/base/ime/text_input_mode.h" | 44 #include "ui/base/ime/text_input_mode.h" |
| 44 #include "ui/base/ime/text_input_type.h" | 45 #include "ui/base/ime/text_input_type.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 150 |
| 150 bool OnMessageReceivedFromEmbedder(const IPC::Message& message); | 151 bool OnMessageReceivedFromEmbedder(const IPC::Message& message); |
| 151 | 152 |
| 152 WebContentsImpl* embedder_web_contents() const { | 153 WebContentsImpl* embedder_web_contents() const { |
| 153 return attached_ ? owner_web_contents_ : nullptr; | 154 return attached_ ? owner_web_contents_ : nullptr; |
| 154 } | 155 } |
| 155 | 156 |
| 156 // Returns the embedder's RenderWidgetHostView if it is available. | 157 // Returns the embedder's RenderWidgetHostView if it is available. |
| 157 // Returns nullptr otherwise. | 158 // Returns nullptr otherwise. |
| 158 RenderWidgetHostView* GetOwnerRenderWidgetHostView(); | 159 RenderWidgetHostView* GetOwnerRenderWidgetHostView(); |
| 160 RenderWidgetHostView* GetTopLevelRenderWidgetHostView(); |
| 159 | 161 |
| 160 bool focused() const { return focused_; } | 162 bool focused() const { return focused_; } |
| 161 bool visible() const { return guest_visible_; } | 163 bool visible() const { return guest_visible_; } |
| 162 bool is_in_destruction() { return is_in_destruction_; } | 164 bool is_in_destruction() { return is_in_destruction_; } |
| 163 | 165 |
| 164 void UpdateVisibility(); | 166 void UpdateVisibility(); |
| 165 | 167 |
| 166 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 168 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
| 167 | 169 |
| 168 // WebContentsObserver implementation. | 170 // WebContentsObserver implementation. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 248 |
| 247 // Find the given |search_text| in the page. Returns true if the find request | 249 // Find the given |search_text| in the page. Returns true if the find request |
| 248 // is handled by this browser plugin guest. | 250 // is handled by this browser plugin guest. |
| 249 bool HandleFindForEmbedder(int request_id, | 251 bool HandleFindForEmbedder(int request_id, |
| 250 const base::string16& search_text, | 252 const base::string16& search_text, |
| 251 const blink::WebFindOptions& options); | 253 const blink::WebFindOptions& options); |
| 252 bool HandleStopFindingForEmbedder(StopFindAction action); | 254 bool HandleStopFindingForEmbedder(StopFindAction action); |
| 253 | 255 |
| 254 void ResendEventToEmbedder(const blink::WebInputEvent& event); | 256 void ResendEventToEmbedder(const blink::WebInputEvent& event); |
| 255 | 257 |
| 258 // TODO(ekaramad): This is used in forcing MimeHandlerView use BrowserPlugin |
| 259 // even when --use-cross-process-frames-for-guests is used. Remove this once |
| 260 // MimeHandlerView uses OOPIF (https://crbug.com/563285). |
| 261 BrowserPluginGuestDelegateMode::DelegateMode delegate_mode() const { |
| 262 return delegate_mode_; |
| 263 } |
| 264 |
| 256 protected: | 265 protected: |
| 257 | 266 |
| 258 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and | 267 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and |
| 259 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. | 268 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. |
| 260 // Constructor protected for testing. | 269 // Constructor protected for testing. |
| 261 BrowserPluginGuest(bool has_render_view, | 270 BrowserPluginGuest(bool has_render_view, |
| 262 WebContentsImpl* web_contents, | 271 WebContentsImpl* web_contents, |
| 263 BrowserPluginGuestDelegate* delegate); | 272 BrowserPluginGuestDelegate* delegate); |
| 264 | 273 |
| 265 // Protected for testing. | 274 // Protected for testing. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 448 |
| 440 // Ignore the URL dragged into guest that is coming from guest. | 449 // Ignore the URL dragged into guest that is coming from guest. |
| 441 bool ignore_dragged_url_; | 450 bool ignore_dragged_url_; |
| 442 | 451 |
| 443 // This is a queue of messages that are destined to be sent to the embedder | 452 // This is a queue of messages that are destined to be sent to the embedder |
| 444 // once the guest is attached to a particular embedder. | 453 // once the guest is attached to a particular embedder. |
| 445 std::deque<linked_ptr<IPC::Message> > pending_messages_; | 454 std::deque<linked_ptr<IPC::Message> > pending_messages_; |
| 446 | 455 |
| 447 BrowserPluginGuestDelegate* const delegate_; | 456 BrowserPluginGuestDelegate* const delegate_; |
| 448 | 457 |
| 458 BrowserPluginGuestDelegateMode::DelegateMode delegate_mode_; |
| 459 |
| 449 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 460 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 450 // permission. | 461 // permission. |
| 451 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 462 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 452 | 463 |
| 453 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 464 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 454 }; | 465 }; |
| 455 | 466 |
| 456 } // namespace content | 467 } // namespace content |
| 457 | 468 |
| 458 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 469 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |