Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: content/child/npapi/webplugin_delegate_impl.h

Issue 19761007: Move NPAPI implementation out of webkit/plugins/npapi and into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_
6 #define WEBKIT_PLUGINS_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 "third_party/npapi/bindings/npapi.h" 18 #include "third_party/npapi/bindings/npapi.h"
18 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
19 #include "ui/gfx/rect.h" 20 #include "ui/gfx/rect.h"
20 #include "webkit/common/cursors/webcursor.h" 21 #include "webkit/common/cursors/webcursor.h"
21 #include "webkit/plugins/npapi/webplugin_delegate.h"
22 #include "webkit/plugins/webkit_plugins_export.h"
23 22
24 #if defined(USE_X11) 23 #if defined(USE_X11)
25 #include "ui/base/x/x11_util.h" 24 #include "ui/base/x/x11_util.h"
26 25
27 typedef struct _GdkDrawable GdkPixmap; 26 typedef struct _GdkDrawable GdkPixmap;
28 #endif 27 #endif
29 28
30 namespace base { 29 namespace base {
31 class FilePath; 30 class FilePath;
32 } 31 }
33 32
34 #if defined(OS_MACOSX) 33 #if defined(OS_MACOSX)
35 #ifdef __OBJC__ 34 #ifdef __OBJC__
36 @class CALayer; 35 @class CALayer;
37 @class CARenderer; 36 @class CARenderer;
38 #else 37 #else
39 class CALayer; 38 class CALayer;
40 class CARenderer; 39 class CARenderer;
41 #endif 40 #endif
42 #endif 41 #endif
43 42
44 namespace webkit { 43 namespace content {
45 namespace npapi {
46 44
47 class PluginInstance; 45 class PluginInstance;
48 46
49 #if defined(OS_MACOSX) 47 #if defined(OS_MACOSX)
50 class WebPluginAcceleratedSurface; 48 class WebPluginAcceleratedSurface;
51 class ExternalDragTracker; 49 class ExternalDragTracker;
52 #endif // OS_MACOSX 50 #endif // OS_MACOSX
53 51
54 #if defined(OS_WIN) 52 #if defined(OS_WIN)
55 class WebPluginIMEWin; 53 class WebPluginIMEWin;
56 #endif // OS_WIN 54 #endif // OS_WIN
57 55
58 // An implementation of WebPluginDelegate that runs in the plugin process, 56 // An implementation of WebPluginDelegate that runs in the plugin process,
59 // proxied from the renderer by WebPluginDelegateProxy. 57 // proxied from the renderer by WebPluginDelegateProxy.
60 class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { 58 class WebPluginDelegateImpl : public WebPluginDelegate {
61 public: 59 public:
62 enum PluginQuirks { 60 enum PluginQuirks {
63 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 61 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32
64 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 62 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32
65 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 63 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32
66 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 64 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32
67 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 65 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32
68 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 66 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32
69 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 67 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32
70 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 68 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32
71 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux 69 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux
72 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux 70 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux
73 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows 71 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows
74 PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows 72 PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows
75 PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows 73 PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows
76 PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows 74 PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows
77 PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux 75 PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux
78 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. 76 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows.
79 PLUGIN_QUIRK_EMULATE_IME = 131072, // Windows. 77 PLUGIN_QUIRK_EMULATE_IME = 131072, // Windows.
80 }; 78 };
81 79
82 static WebPluginDelegateImpl* Create(const base::FilePath& filename, 80 static WebPluginDelegateImpl* Create(const base::FilePath& filename,
83 const std::string& mime_type); 81 const std::string& mime_type);
84 82
85 #if defined(OS_WIN)
86 static bool IsPluginDelegateWindow(HWND window);
87 static bool GetPluginNameFromWindow(HWND window,
88 base::string16* plugin_name);
89 static bool GetPluginVersionFromWindow(HWND window,
90 base::string16* plugin_version);
91
92 // Returns true if the window handle passed in is that of the dummy
93 // activation window for windowless plugins.
94 static bool IsDummyActivationWindow(HWND window);
95
96 // Returns the default HWND to parent the windowed plugins and dummy windows
97 // for activation to when none isavailable.
98 static HWND GetDefaultWindowParent();
99 #endif
100
101 // WebPluginDelegate implementation 83 // WebPluginDelegate implementation
102 virtual bool Initialize(const GURL& url, 84 virtual bool Initialize(const GURL& url,
103 const std::vector<std::string>& arg_names, 85 const std::vector<std::string>& arg_names,
104 const std::vector<std::string>& arg_values, 86 const std::vector<std::string>& arg_values,
105 WebPlugin* plugin, 87 WebPlugin* plugin,
106 bool load_manually) OVERRIDE; 88 bool load_manually) OVERRIDE;
107 virtual void PluginDestroyed() OVERRIDE; 89 virtual void PluginDestroyed() OVERRIDE;
108 virtual void UpdateGeometry(const gfx::Rect& window_rect, 90 virtual void UpdateGeometry(const gfx::Rect& window_rect,
109 const gfx::Rect& clip_rect) OVERRIDE; 91 const gfx::Rect& clip_rect) OVERRIDE;
110 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE; 92 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // where SetContentAreaHasFocus is never called. See 476 // where SetContentAreaHasFocus is never called. See
495 // https://bugs.webkit.org/show_bug.cgi?id=46013 for details. 477 // https://bugs.webkit.org/show_bug.cgi?id=46013 for details.
496 bool containing_view_has_focus_; 478 bool containing_view_has_focus_;
497 479
498 // True if NPP_New did not return an error. 480 // True if NPP_New did not return an error.
499 bool creation_succeeded_; 481 bool creation_succeeded_;
500 482
501 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); 483 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl);
502 }; 484 };
503 485
504 } // namespace npapi 486 } // namespace content
505 } // namespace webkit
506 487
507 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ 488 #endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698