| 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_AutoSize_Params; |
| 46 struct BrowserPluginHostMsg_CreateGuest_Params; | 47 struct BrowserPluginHostMsg_CreateGuest_Params; |
| 47 struct BrowserPluginHostMsg_ResizeGuest_Params; | 48 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 48 class TransportDIB; | 49 class TransportDIB; |
| 49 struct ViewHostMsg_UpdateRect_Params; | 50 struct ViewHostMsg_UpdateRect_Params; |
| 50 struct WebDropData; | 51 struct WebDropData; |
| 51 | 52 |
| 52 namespace WebKit { | 53 namespace WebKit { |
| 53 class WebInputEvent; | 54 class WebInputEvent; |
| 54 } | 55 } |
| 55 | 56 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Handles drag events from the embedder. | 172 // Handles drag events from the embedder. |
| 172 // When dragging, the drag events go to the embedder first, and if the drag | 173 // When dragging, the drag events go to the embedder first, and if the drag |
| 173 // happens on the browser plugin, then the plugin sends a corresponding | 174 // happens on the browser plugin, then the plugin sends a corresponding |
| 174 // drag-message to the guest. This routes the drag-message to the guest | 175 // drag-message to the guest. This routes the drag-message to the guest |
| 175 // renderer. | 176 // renderer. |
| 176 void DragStatusUpdate(WebKit::WebDragStatus drag_status, | 177 void DragStatusUpdate(WebKit::WebDragStatus drag_status, |
| 177 const WebDropData& drop_data, | 178 const WebDropData& drop_data, |
| 178 WebKit::WebDragOperationsMask drag_mask, | 179 WebKit::WebDragOperationsMask drag_mask, |
| 179 const gfx::Point& location); | 180 const gfx::Point& location); |
| 180 | 181 |
| 182 // Updates the autosize state of the guest. |
| 183 void SetAutoSize( |
| 184 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, |
| 185 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); |
| 186 |
| 181 // Updates the cursor during dragging. | 187 // Updates the cursor during dragging. |
| 182 // During dragging, if the guest notifies to update the cursor for a drag, | 188 // During dragging, if the guest notifies to update the cursor for a drag, |
| 183 // then it is necessary to route the cursor update to the embedder correctly | 189 // then it is necessary to route the cursor update to the embedder correctly |
| 184 // so that the cursor updates properly. | 190 // so that the cursor updates properly. |
| 185 void UpdateDragCursor(WebKit::WebDragOperation operation); | 191 void UpdateDragCursor(WebKit::WebDragOperation operation); |
| 186 | 192 |
| 187 // Exposes the protected web_contents() from WebContentsObserver. | 193 // Exposes the protected web_contents() from WebContentsObserver. |
| 188 WebContents* GetWebContents(); | 194 WebContents* GetWebContents(); |
| 189 | 195 |
| 190 // Kill the guest process. | 196 // Kill the guest process. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 249 |
| 244 // Helper to send messages to embedder. Overridden in test implementation | 250 // Helper to send messages to embedder. Overridden in test implementation |
| 245 // since we want to intercept certain messages for testing. | 251 // since we want to intercept certain messages for testing. |
| 246 virtual void SendMessageToEmbedder(IPC::Message* msg); | 252 virtual void SendMessageToEmbedder(IPC::Message* msg); |
| 247 | 253 |
| 248 // Called when a redirect notification occurs. | 254 // Called when a redirect notification occurs. |
| 249 void LoadRedirect(const GURL& old_url, | 255 void LoadRedirect(const GURL& old_url, |
| 250 const GURL& new_url, | 256 const GURL& new_url, |
| 251 bool is_top_level); | 257 bool is_top_level); |
| 252 | 258 |
| 259 bool InAutoSizeBounds(const gfx::Size& size) const; |
| 253 // Static factory instance (always NULL for non-test). | 260 // Static factory instance (always NULL for non-test). |
| 254 static content::BrowserPluginHostFactory* factory_; | 261 static content::BrowserPluginHostFactory* factory_; |
| 255 | 262 |
| 256 NotificationRegistrar notification_registrar_; | 263 NotificationRegistrar notification_registrar_; |
| 257 WebContentsImpl* embedder_web_contents_; | 264 WebContentsImpl* embedder_web_contents_; |
| 258 // An identifier that uniquely identifies a browser plugin guest within an | 265 // An identifier that uniquely identifies a browser plugin guest within an |
| 259 // embedder. | 266 // embedder. |
| 260 int instance_id_; | 267 int instance_id_; |
| 261 scoped_ptr<TransportDIB> damage_buffer_; | 268 scoped_ptr<TransportDIB> damage_buffer_; |
| 262 #if defined(OS_WIN) | 269 #if defined(OS_WIN) |
| 263 size_t damage_buffer_size_; | 270 size_t damage_buffer_size_; |
| 264 #endif | 271 #endif |
| 265 gfx::Size damage_view_size_; | 272 gfx::Size damage_view_size_; |
| 266 float damage_buffer_scale_factor_; | 273 float damage_buffer_scale_factor_; |
| 267 scoped_ptr<IPC::Message> pending_input_event_reply_; | 274 scoped_ptr<IPC::Message> pending_input_event_reply_; |
| 268 gfx::Rect guest_rect_; | 275 gfx::Rect guest_rect_; |
| 269 WebCursor cursor_; | 276 WebCursor cursor_; |
| 270 IDMap<RenderViewHost> pending_updates_; | 277 IDMap<RenderViewHost> pending_updates_; |
| 271 int pending_update_counter_; | 278 int pending_update_counter_; |
| 272 base::TimeDelta guest_hang_timeout_; | 279 base::TimeDelta guest_hang_timeout_; |
| 273 bool focused_; | 280 bool focused_; |
| 274 bool visible_; | 281 bool visible_; |
| 275 bool auto_size_; | 282 bool auto_size_; |
| 276 int max_height_; | 283 gfx::Size max_auto_size_; |
| 277 int max_width_; | 284 gfx::Size min_auto_size_; |
| 278 int min_height_; | |
| 279 int min_width_; | |
| 280 | 285 |
| 281 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 286 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 282 }; | 287 }; |
| 283 | 288 |
| 284 } // namespace content | 289 } // namespace content |
| 285 | 290 |
| 286 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 291 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |