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/common/edit_command.h" | 28 #include "content/common/edit_command.h" |
29 #include "content/common/input/input_event_ack_state.h" | 29 #include "content/common/input/input_event_ack_state.h" |
| 30 #include "content/common/readback_types.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" |
38 #include "ui/gfx/rect.h" | 39 #include "ui/gfx/rect.h" |
39 | 40 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Returns the embedder's RenderWidgetHostView if it is available. | 137 // Returns the embedder's RenderWidgetHostView if it is available. |
137 // Returns NULL otherwise. | 138 // Returns NULL otherwise. |
138 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); | 139 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); |
139 | 140 |
140 bool focused() const { return focused_; } | 141 bool focused() const { return focused_; } |
141 bool visible() const { return guest_visible_; } | 142 bool visible() const { return guest_visible_; } |
142 bool is_in_destruction() { return is_in_destruction_; } | 143 bool is_in_destruction() { return is_in_destruction_; } |
143 | 144 |
144 void UpdateVisibility(); | 145 void UpdateVisibility(); |
145 | 146 |
146 void CopyFromCompositingSurface( | 147 void CopyFromCompositingSurface(gfx::Rect src_subrect, |
147 gfx::Rect src_subrect, | 148 gfx::Size dst_size, |
148 gfx::Size dst_size, | 149 CopyFromCompositingSurfaceCallback& callback); |
149 const base::Callback<void(bool, const SkBitmap&)>& callback); | |
150 | 150 |
151 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 151 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
152 | 152 |
153 // WebContentsObserver implementation. | 153 // WebContentsObserver implementation. |
154 virtual void DidCommitProvisionalLoadForFrame( | 154 virtual void DidCommitProvisionalLoadForFrame( |
155 RenderFrameHost* render_frame_host, | 155 RenderFrameHost* render_frame_host, |
156 const GURL& url, | 156 const GURL& url, |
157 ui::PageTransition transition_type) OVERRIDE; | 157 ui::PageTransition transition_type) OVERRIDE; |
158 | 158 |
159 virtual void RenderViewReady() OVERRIDE; | 159 virtual void RenderViewReady() OVERRIDE; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 gfx::Rect guest_window_rect_; | 335 gfx::Rect guest_window_rect_; |
336 bool focused_; | 336 bool focused_; |
337 bool mouse_locked_; | 337 bool mouse_locked_; |
338 bool pending_lock_request_; | 338 bool pending_lock_request_; |
339 bool guest_visible_; | 339 bool guest_visible_; |
340 bool embedder_visible_; | 340 bool embedder_visible_; |
341 | 341 |
342 // Each copy-request is identified by a unique number. The unique number is | 342 // Each copy-request is identified by a unique number. The unique number is |
343 // used to keep track of the right callback. | 343 // used to keep track of the right callback. |
344 int copy_request_id_; | 344 int copy_request_id_; |
345 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; | 345 typedef std::map<int, const CopyFromCompositingSurfaceCallback> |
346 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; | 346 CopyRequestMap; |
347 CopyRequestMap copy_request_callbacks_; | 347 CopyRequestMap copy_request_callbacks_; |
348 | 348 |
349 // Indicates that this BrowserPluginGuest has associated renderer-side state. | 349 // Indicates that this BrowserPluginGuest has associated renderer-side state. |
350 // This is used to determine whether or not to create a new RenderView when | 350 // This is used to determine whether or not to create a new RenderView when |
351 // this guest is attached. A BrowserPluginGuest would have renderer-side state | 351 // this guest is attached. A BrowserPluginGuest would have renderer-side state |
352 // prior to attachment if it is created via a call to window.open and | 352 // prior to attachment if it is created via a call to window.open and |
353 // maintains a JavaScript reference to its opener. | 353 // maintains a JavaScript reference to its opener. |
354 bool has_render_view_; | 354 bool has_render_view_; |
355 | 355 |
356 // Last seen size of guest contents (by SwapCompositorFrame). | 356 // Last seen size of guest contents (by SwapCompositorFrame). |
(...skipping 17 matching lines...) Expand all Loading... |
374 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 374 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
375 // permission. | 375 // permission. |
376 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 376 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
377 | 377 |
378 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 378 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
379 }; | 379 }; |
380 | 380 |
381 } // namespace content | 381 } // namespace content |
382 | 382 |
383 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 383 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |