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 CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
6 #define CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 6 #define CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/sequenced_task_runner_helpers.h" | 14 #include "base/sequenced_task_runner_helpers.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "content/child/npapi/webplugin_delegate.h" | 17 #include "content/child/npapi/webplugin_delegate.h" |
18 #include "content/common/cursors/webcursor.h" | 18 #include "content/common/cursors/webcursor.h" |
19 #include "third_party/npapi/bindings/npapi.h" | 19 #include "third_party/npapi/bindings/npapi.h" |
20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
21 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
22 | 22 |
23 #if defined(USE_X11) | |
24 #include "ui/base/x/x11_util.h" | |
25 | |
26 typedef struct _GdkDrawable GdkPixmap; | |
27 #endif | |
28 | |
29 namespace base { | 23 namespace base { |
30 class FilePath; | 24 class FilePath; |
31 } | 25 } |
32 | 26 |
33 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
34 #ifdef __OBJC__ | 28 #ifdef __OBJC__ |
35 @class CALayer; | 29 @class CALayer; |
36 @class CARenderer; | 30 @class CARenderer; |
37 #else | 31 #else |
38 class CALayer; | 32 class CALayer; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Indicates that the windowless plugins will draw directly to the window | 185 // Indicates that the windowless plugins will draw directly to the window |
192 // context instead of a buffer context. | 186 // context instead of a buffer context. |
193 void SetNoBufferContext(); | 187 void SetNoBufferContext(); |
194 | 188 |
195 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia | 189 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia |
196 // port to share code with the Darwin / CG port. Later, this will be removed | 190 // port to share code with the Darwin / CG port. Later, this will be removed |
197 // and all callers will use the Paint defined above. | 191 // and all callers will use the Paint defined above. |
198 void CGPaint(CGContextRef context, const gfx::Rect& rect); | 192 void CGPaint(CGContextRef context, const gfx::Rect& rect); |
199 #endif // OS_MACOSX && !USE_AURA | 193 #endif // OS_MACOSX && !USE_AURA |
200 | 194 |
201 #if defined(USE_X11) | |
202 void SetWindowlessShmPixmap(XID shm_pixmap) { | |
203 windowless_shm_pixmap_ = shm_pixmap; | |
204 } | |
205 #endif | |
206 | |
207 private: | 195 private: |
208 friend class base::DeleteHelper<WebPluginDelegateImpl>; | 196 friend class base::DeleteHelper<WebPluginDelegateImpl>; |
209 friend class WebPluginDelegate; | 197 friend class WebPluginDelegate; |
210 | 198 |
211 WebPluginDelegateImpl(WebPlugin* plugin, PluginInstance* instance); | 199 WebPluginDelegateImpl(WebPlugin* plugin, PluginInstance* instance); |
212 virtual ~WebPluginDelegateImpl(); | 200 virtual ~WebPluginDelegateImpl(); |
213 | 201 |
214 // Called by Initialize() for platform-specific initialization. | 202 // Called by Initialize() for platform-specific initialization. |
215 // If this returns false, the plugin shouldn't be started--see Initialize(). | 203 // If this returns false, the plugin shouldn't be started--see Initialize(). |
216 bool PlatformInitialize(); | 204 bool PlatformInitialize(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 300 |
313 // Used to throttle WM_USER+1 messages in Flash. | 301 // Used to throttle WM_USER+1 messages in Flash. |
314 uint32 last_message_; | 302 uint32 last_message_; |
315 bool is_calling_wndproc; | 303 bool is_calling_wndproc; |
316 | 304 |
317 // An IME emulator used by a windowless plug-in to retrieve IME data through | 305 // An IME emulator used by a windowless plug-in to retrieve IME data through |
318 // IMM32 functions. | 306 // IMM32 functions. |
319 scoped_ptr<WebPluginIMEWin> plugin_ime_; | 307 scoped_ptr<WebPluginIMEWin> plugin_ime_; |
320 #endif // defined(OS_WIN) | 308 #endif // defined(OS_WIN) |
321 | 309 |
322 #if defined(USE_X11) | |
323 // The SHM pixmap for a windowless plugin. | |
324 XID windowless_shm_pixmap_; | |
325 #endif | |
326 | |
327 #if defined(TOOLKIT_GTK) | |
328 // The pixmap we're drawing into, for a windowless plugin. | |
329 GdkPixmap* pixmap_; | |
330 double first_event_time_; | |
331 | |
332 // On Linux some plugins assume that the GtkSocket container is in the same | |
333 // process. So we create a GtkPlug to plug into the browser's container, and | |
334 // a GtkSocket to hold the plugin. We then send the GtkPlug to the browser | |
335 // process. | |
336 GtkWidget* plug_; | |
337 GtkWidget* socket_; | |
338 | |
339 // Ensure pixmap_ exists and is at least width by height pixels. | |
340 void EnsurePixmapAtLeastSize(int width, int height); | |
341 #endif | |
342 | |
343 NPWindow window_; | 310 NPWindow window_; |
344 gfx::Rect window_rect_; | 311 gfx::Rect window_rect_; |
345 gfx::Rect clip_rect_; | 312 gfx::Rect clip_rect_; |
346 int quirks_; | 313 int quirks_; |
347 | 314 |
348 #if defined(OS_WIN) | 315 #if defined(OS_WIN) |
349 // Windowless plugins don't have keyboard focus causing issues with the | 316 // Windowless plugins don't have keyboard focus causing issues with the |
350 // plugin not receiving keyboard events if the plugin enters a modal | 317 // plugin not receiving keyboard events if the plugin enters a modal |
351 // loop like TrackPopupMenuEx or MessageBox, etc. | 318 // loop like TrackPopupMenuEx or MessageBox, etc. |
352 // This is a basic issue with windows activation and focus arising due to | 319 // This is a basic issue with windows activation and focus arising due to |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 467 |
501 // True if NPP_New did not return an error. | 468 // True if NPP_New did not return an error. |
502 bool creation_succeeded_; | 469 bool creation_succeeded_; |
503 | 470 |
504 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); | 471 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); |
505 }; | 472 }; |
506 | 473 |
507 } // namespace content | 474 } // namespace content |
508 | 475 |
509 #endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 476 #endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |