| 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 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 void UpdateGeometryAndContext(const gfx::Rect& window_rect, | 169 void UpdateGeometryAndContext(const gfx::Rect& window_rect, |
| 170 const gfx::Rect& clip_rect, | 170 const gfx::Rect& clip_rect, |
| 171 gfx::NativeDrawingContext context); | 171 gfx::NativeDrawingContext context); |
| 172 // Informs the delegate that the plugin called NPN_Invalidate*. Used as a | 172 // Informs the delegate that the plugin called NPN_Invalidate*. Used as a |
| 173 // trigger for Core Animation drawing. | 173 // trigger for Core Animation drawing. |
| 174 void PluginDidInvalidate(); | 174 void PluginDidInvalidate(); |
| 175 // Returns the delegate currently processing events. | 175 // Returns the delegate currently processing events. |
| 176 static WebPluginDelegateImpl* GetActiveDelegate(); | 176 static WebPluginDelegateImpl* GetActiveDelegate(); |
| 177 // Informs the plugin that the window it is in has gained or lost focus. | 177 // Informs the plugin that the window it is in has gained or lost focus. |
| 178 void SetWindowHasFocus(bool has_focus); | 178 void SetWindowHasFocus(bool has_focus); |
| 179 // Returns whether or not the window the plugin is in has focus. | |
| 180 bool GetWindowHasFocus() const { return containing_window_has_focus_; } | |
| 181 // Informs the plugin that its tab or window has been hidden or shown. | 179 // Informs the plugin that its tab or window has been hidden or shown. |
| 182 void SetContainerVisibility(bool is_visible); | 180 void SetContainerVisibility(bool is_visible); |
| 183 // Informs the plugin that its containing window's frame has changed. | 181 // Informs the plugin that its containing window's frame has changed. |
| 184 // Frames are in screen coordinates. | 182 // Frames are in screen coordinates. |
| 185 void WindowFrameChanged(const gfx::Rect& window_frame, | 183 void WindowFrameChanged(const gfx::Rect& window_frame, |
| 186 const gfx::Rect& view_frame); | 184 const gfx::Rect& view_frame); |
| 187 // Informs the plugin that IME composition has completed. | 185 // Informs the plugin that IME composition has completed. |
| 188 // If |text| is empty, IME was cancelled. | 186 // If |text| is empty, IME was cancelled. |
| 189 void ImeCompositionCompleted(const string16& text); | 187 void ImeCompositionCompleted(const string16& text); |
| 190 #ifndef NP_NO_CARBON | 188 #ifndef NP_NO_CARBON |
| 191 // Informs the delegate that the plugin set a Carbon ThemeCursor. | 189 // Informs the delegate that the plugin set a Carbon ThemeCursor. |
| 192 void SetThemeCursor(ThemeCursor cursor); | 190 void SetThemeCursor(ThemeCursor cursor); |
| 193 // Informs the delegate that the plugin set a Carbon Cursor. | 191 // Informs the delegate that the plugin set a Carbon Cursor. |
| 194 void SetCarbonCursor(const Cursor* cursor); | 192 void SetCarbonCursor(const Cursor* cursor); |
| 195 #endif | 193 #endif |
| 196 // Informs the delegate that the plugin set a Cocoa NSCursor. | 194 // Informs the delegate that the plugin set a Cocoa NSCursor. |
| 197 void SetNSCursor(NSCursor* cursor); | 195 void SetNSCursor(NSCursor* cursor); |
| 198 | 196 |
| 199 // Indicates that the windowless plugins will draw directly to the window | 197 // Indicates that the windowless plugins will draw directly to the window |
| 200 // context instead of a buffer context. | 198 // context instead of a buffer context. |
| 201 void SetNoBufferContext(); | 199 void SetNoBufferContext(); |
| 202 | 200 |
| 203 #ifndef NP_NO_CARBON | |
| 204 // Indicates that it's time to send the plugin a null event. | |
| 205 void FireIdleEvent(); | |
| 206 #endif | |
| 207 | |
| 208 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia | 201 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia |
| 209 // port to share code with the Darwin / CG port. Later, this will be removed | 202 // port to share code with the Darwin / CG port. Later, this will be removed |
| 210 // and all callers will use the Paint defined above. | 203 // and all callers will use the Paint defined above. |
| 211 void CGPaint(CGContextRef context, const gfx::Rect& rect); | 204 void CGPaint(CGContextRef context, const gfx::Rect& rect); |
| 212 | |
| 213 bool AllowBufferFlipping(); | |
| 214 #endif // OS_MACOSX && !USE_AURA | 205 #endif // OS_MACOSX && !USE_AURA |
| 215 | 206 |
| 216 gfx::PluginWindowHandle windowed_handle() const { | 207 gfx::PluginWindowHandle windowed_handle() const { |
| 217 return windowed_handle_; | 208 return windowed_handle_; |
| 218 } | 209 } |
| 219 | 210 |
| 220 #if defined(OS_MACOSX) | 211 #if defined(OS_MACOSX) |
| 221 // Allow setting a "fake" window handle to associate this plug-in with | 212 // Allow setting a "fake" window handle to associate this plug-in with |
| 222 // an IOSurface in the browser. Used for accelerated drawing surfaces. | 213 // an IOSurface in the browser. Used for accelerated drawing surfaces. |
| 223 void set_windowed_handle(gfx::PluginWindowHandle handle); | 214 void set_windowed_handle(gfx::PluginWindowHandle handle); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 436 |
| 446 // Starts an IME session. | 437 // Starts an IME session. |
| 447 void StartIme(); | 438 void StartIme(); |
| 448 | 439 |
| 449 // Informs the browser about the updated accelerated drawing surface. | 440 // Informs the browser about the updated accelerated drawing surface. |
| 450 void UpdateAcceleratedSurface(); | 441 void UpdateAcceleratedSurface(); |
| 451 | 442 |
| 452 // Uses a CARenderer to draw the plug-in's layer in our OpenGL surface. | 443 // Uses a CARenderer to draw the plug-in's layer in our OpenGL surface. |
| 453 void DrawLayerInSurface(); | 444 void DrawLayerInSurface(); |
| 454 | 445 |
| 455 #ifndef NP_NO_CARBON | |
| 456 // Moves our dummy window to match the current screen location of the plugin. | |
| 457 void UpdateDummyWindowBounds(const gfx::Point& plugin_origin); | |
| 458 | |
| 459 // Adjusts the idle event rate for a Carbon plugin based on its current | |
| 460 // visibility. | |
| 461 void UpdateIdleEventRate(); | |
| 462 #endif // !NP_NO_CARBON | |
| 463 | |
| 464 bool use_buffer_context_; | 446 bool use_buffer_context_; |
| 465 CGContextRef buffer_context_; // Weak ref. | 447 CGContextRef buffer_context_; // Weak ref. |
| 466 | 448 |
| 467 #ifndef NP_NO_CARBON | |
| 468 NP_CGContext np_cg_context_; | |
| 469 #endif | |
| 470 | |
| 471 CALayer* layer_; // Used for CA drawing mode. Weak, retained by plug-in. | 449 CALayer* layer_; // Used for CA drawing mode. Weak, retained by plug-in. |
| 472 WebPluginAcceleratedSurface* surface_; // Weak ref. | 450 WebPluginAcceleratedSurface* surface_; // Weak ref. |
| 473 bool composited_; // If CA plugin, whether it's rendering via compositor. | 451 bool composited_; // If CA plugin, whether it's rendering via compositor. |
| 474 CARenderer* renderer_; // Renders layer_ to surface_. | 452 CARenderer* renderer_; // Renders layer_ to surface_. |
| 475 scoped_ptr<base::RepeatingTimer<WebPluginDelegateImpl> > redraw_timer_; | 453 scoped_ptr<base::RepeatingTimer<WebPluginDelegateImpl> > redraw_timer_; |
| 476 | 454 |
| 477 // The upper-left corner of the web content area in screen coordinates, | 455 // The upper-left corner of the web content area in screen coordinates, |
| 478 // relative to an upper-left (0,0). | 456 // relative to an upper-left (0,0). |
| 479 gfx::Point content_area_origin_; | 457 gfx::Point content_area_origin_; |
| 480 | 458 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 // True if NPP_New did not return an error. | 525 // True if NPP_New did not return an error. |
| 548 bool creation_succeeded_; | 526 bool creation_succeeded_; |
| 549 | 527 |
| 550 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); | 528 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); |
| 551 }; | 529 }; |
| 552 | 530 |
| 553 } // namespace npapi | 531 } // namespace npapi |
| 554 } // namespace webkit | 532 } // namespace webkit |
| 555 | 533 |
| 556 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 534 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
| OLD | NEW |