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 represents the browser side of browser <--> renderer | 5 // A BrowserPluginGuest represents the browser side of browser <--> renderer |
| 6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of | 6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of |
| 7 // browser <--> guest renderer communication. The 'guest' renderer is a | 7 // browser <--> guest renderer communication. The 'guest' renderer is a |
| 8 // <browser> tag. | 8 // <browser> tag. |
| 9 // | 9 // |
| 10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a | 10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "base/time.h" | 36 #include "base/time.h" |
| 37 #include "content/public/browser/notification_observer.h" | 37 #include "content/public/browser/notification_observer.h" |
| 38 #include "content/public/browser/notification_registrar.h" | 38 #include "content/public/browser/notification_registrar.h" |
| 39 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
| 40 #include "content/public/browser/web_contents_observer.h" | 40 #include "content/public/browser/web_contents_observer.h" |
| 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h" |
| 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
| 43 #include "ui/gfx/rect.h" | 43 #include "ui/gfx/rect.h" |
| 44 #include "webkit/glue/webcursor.h" | 44 #include "webkit/glue/webcursor.h" |
| 45 | 45 |
| 46 struct BrowserPluginHostMsg_CreateGuest_Params; | |
| 46 class TransportDIB; | 47 class TransportDIB; |
| 47 struct ViewHostMsg_UpdateRect_Params; | 48 struct ViewHostMsg_UpdateRect_Params; |
| 48 struct WebDropData; | 49 struct WebDropData; |
| 49 | 50 |
| 50 namespace WebKit { | 51 namespace WebKit { |
| 51 class WebInputEvent; | 52 class WebInputEvent; |
| 52 } | 53 } |
| 53 | 54 |
| 54 namespace content { | 55 namespace content { |
| 55 | 56 |
| 56 class BrowserPluginHostFactory; | 57 class BrowserPluginHostFactory; |
| 57 class BrowserPluginEmbedder; | 58 class BrowserPluginEmbedder; |
| 58 class RenderProcessHost; | 59 class RenderProcessHost; |
| 59 | 60 |
| 60 // A browser plugin guest provides functionality for WebContents to operate in | 61 // A browser plugin guest provides functionality for WebContents to operate in |
| 61 // the guest role and implements guest specific overrides for ViewHostMsg_* | 62 // the guest role and implements guest specific overrides for ViewHostMsg_* |
| 62 // messages. | 63 // messages. |
| 63 // | 64 // |
| 64 // BrowserPluginEmbedder is responsible for creating and destroying a guest. | 65 // BrowserPluginEmbedder is responsible for creating and destroying a guest. |
| 65 class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, | 66 class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| 66 public WebContentsDelegate, | 67 public WebContentsDelegate, |
| 67 public WebContentsObserver { | 68 public WebContentsObserver { |
| 68 public: | 69 public: |
| 69 virtual ~BrowserPluginGuest(); | 70 virtual ~BrowserPluginGuest(); |
| 70 | 71 |
| 71 static BrowserPluginGuest* Create(int instance_id, | 72 static BrowserPluginGuest* Create( |
| 72 WebContentsImpl* web_contents, | 73 int instance_id, |
| 73 content::RenderViewHost* render_view_host, | 74 WebContentsImpl* web_contents, |
| 74 bool focused, | 75 content::RenderViewHost* render_view_host, |
| 75 bool visible); | 76 const BrowserPluginHostMsg_CreateGuest_Params& params); |
| 76 | 77 |
| 77 // Overrides factory for testing. Default (NULL) value indicates regular | 78 // Overrides factory for testing. Default (NULL) value indicates regular |
| 78 // (non-test) environment. | 79 // (non-test) environment. |
| 79 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { | 80 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { |
| 80 content::BrowserPluginGuest::factory_ = factory; | 81 content::BrowserPluginGuest::factory_ = factory; |
| 81 } | 82 } |
| 82 | 83 |
| 83 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) { | 84 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) { |
| 84 guest_hang_timeout_ = timeout; | 85 guest_hang_timeout_ = timeout; |
| 85 } | 86 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 #endif | 213 #endif |
| 213 const gfx::Size& damage_view_size, | 214 const gfx::Size& damage_view_size, |
| 214 float scale_factor); | 215 float scale_factor); |
| 215 | 216 |
| 216 private: | 217 private: |
| 217 friend class TestBrowserPluginGuest; | 218 friend class TestBrowserPluginGuest; |
| 218 | 219 |
| 219 BrowserPluginGuest(int instance_id, | 220 BrowserPluginGuest(int instance_id, |
| 220 WebContentsImpl* web_contents, | 221 WebContentsImpl* web_contents, |
| 221 RenderViewHost* render_view_host, | 222 RenderViewHost* render_view_host, |
| 222 bool focused, | 223 const BrowserPluginHostMsg_CreateGuest_Params& params); |
| 223 bool visible); | |
| 224 | 224 |
| 225 // Returns the identifier that uniquely identifies a browser plugin guest | 225 // Returns the identifier that uniquely identifies a browser plugin guest |
| 226 // within an embedder. | 226 // within an embedder. |
| 227 int instance_id() const { return instance_id_; } | 227 int instance_id() const { return instance_id_; } |
| 228 TransportDIB* damage_buffer() const { return damage_buffer_.get(); } | 228 TransportDIB* damage_buffer() const { return damage_buffer_.get(); } |
| 229 const gfx::Size& damage_view_size() const { return damage_view_size_; } | 229 const gfx::Size& damage_view_size() const { return damage_view_size_; } |
| 230 float damage_buffer_scale_factor() const { | 230 float damage_buffer_scale_factor() const { |
| 231 return damage_buffer_scale_factor_; | 231 return damage_buffer_scale_factor_; |
| 232 } | 232 } |
| 233 | 233 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 255 gfx::Size damage_view_size_; | 255 gfx::Size damage_view_size_; |
| 256 float damage_buffer_scale_factor_; | 256 float damage_buffer_scale_factor_; |
| 257 scoped_ptr<IPC::Message> pending_input_event_reply_; | 257 scoped_ptr<IPC::Message> pending_input_event_reply_; |
| 258 gfx::Rect guest_rect_; | 258 gfx::Rect guest_rect_; |
| 259 WebCursor cursor_; | 259 WebCursor cursor_; |
| 260 IDMap<RenderViewHost> pending_updates_; | 260 IDMap<RenderViewHost> pending_updates_; |
| 261 int pending_update_counter_; | 261 int pending_update_counter_; |
| 262 base::TimeDelta guest_hang_timeout_; | 262 base::TimeDelta guest_hang_timeout_; |
| 263 bool focused_; | 263 bool focused_; |
| 264 bool visible_; | 264 bool visible_; |
| 265 bool autosize_; | |
| 266 int minwidth_; | |
|
jam
2012/11/02 19:11:10
ditto
Fady Samuel
2012/11/02 20:32:23
Done.
| |
| 267 int maxwidth_; | |
| 268 int minheight_; | |
| 269 int maxheight_; | |
| 265 | 270 |
| 266 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 271 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 267 }; | 272 }; |
| 268 | 273 |
| 269 } // namespace content | 274 } // namespace content |
| 270 | 275 |
| 271 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 276 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |