| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ | 5 #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
| 6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ | 6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <list> | 11 #include <list> |
| 12 | 12 |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/gfx/native_widget_types.h" | 14 #include "base/gfx/native_widget_types.h" |
| 15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 16 #include "base/task.h" | 16 #include "base/task.h" |
| 17 #include "third_party/npapi/bindings/npapi.h" | 17 #include "third_party/npapi/bindings/npapi.h" |
| 18 #include "webkit/glue/webplugin_delegate.h" | 18 #include "webkit/glue/webplugin_delegate.h" |
| 19 #include "webkit/glue/webcursor.h" | 19 #include "webkit/glue/webcursor.h" |
| 20 | 20 |
| 21 namespace NPAPI { | 21 namespace NPAPI { |
| 22 class PluginInstance; | 22 class PluginInstance; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 // An implementation of WebPluginDelegate that proxies all calls to | 25 // An implementation of WebPluginDelegate that proxies all calls to |
| 26 // the plugin process. | 26 // the plugin process. |
| 27 class WebPluginDelegateImpl : public WebPluginDelegate { | 27 class WebPluginDelegateImpl : public WebPluginDelegate { |
| 28 public: | 28 public: |
| 29 static WebPluginDelegateImpl* Create(const FilePath& filename, | |
| 30 const std::string& mime_type, | |
| 31 gfx::NativeView containing_view); | |
| 32 static bool IsPluginDelegateWindow(gfx::NativeWindow window); | 29 static bool IsPluginDelegateWindow(gfx::NativeWindow window); |
| 33 static bool GetPluginNameFromWindow(gfx::NativeWindow window, | 30 static bool GetPluginNameFromWindow(gfx::NativeWindow window, |
| 34 std::wstring *plugin_name); | 31 std::wstring *plugin_name); |
| 35 | 32 |
| 36 // Returns true if the window handle passed in is that of the dummy | 33 // Returns true if the window handle passed in is that of the dummy |
| 37 // activation window for windowless plugins. | 34 // activation window for windowless plugins. |
| 38 static bool IsDummyActivationWindow(gfx::NativeWindow window); | 35 static bool IsDummyActivationWindow(gfx::NativeWindow window); |
| 39 | 36 |
| 40 // WebPluginDelegate implementation | 37 // WebPluginDelegate implementation |
| 41 virtual void PluginDestroyed(); | 38 virtual void PluginDestroyed(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 virtual FilePath GetPluginPath(); | 72 virtual FilePath GetPluginPath(); |
| 76 virtual void InstallMissingPlugin(); | 73 virtual void InstallMissingPlugin(); |
| 77 virtual WebPluginResourceClient* CreateResourceClient(int resource_id, | 74 virtual WebPluginResourceClient* CreateResourceClient(int resource_id, |
| 78 const std::string &url, | 75 const std::string &url, |
| 79 bool notify_needed, | 76 bool notify_needed, |
| 80 void *notify_data, | 77 void *notify_data, |
| 81 void* stream); | 78 void* stream); |
| 82 | 79 |
| 83 virtual void URLRequestRouted(const std::string&url, bool notify_needed, | 80 virtual void URLRequestRouted(const std::string&url, bool notify_needed, |
| 84 void* notify_data); | 81 void* notify_data); |
| 85 bool windowless() const { return windowless_ ; } | 82 virtual bool IsWindowless() const { return windowless_ ; } |
| 86 gfx::Rect rect() const { return window_rect_; } | 83 virtual const gfx::Rect& GetRect() const { return window_rect_; } |
| 87 gfx::Rect clip_rect() const { return clip_rect_; } | 84 virtual const gfx::Rect& GetClipRect() const { return clip_rect_; } |
| 88 | 85 virtual int GetQuirks() const { return quirks_; } |
| 89 #if defined(OS_WIN) | |
| 90 enum PluginQuirks { | |
| 91 PLUGIN_QUIRK_SETWINDOW_TWICE = 1 << 0, | |
| 92 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 1 << 1, | |
| 93 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 1 << 2, | |
| 94 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 1 << 3, | |
| 95 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 1 << 4, | |
| 96 PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU = 1 << 5, | |
| 97 PLUGIN_QUIRK_PATCH_SETCURSOR = 1 << 6, | |
| 98 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 1 << 7, | |
| 99 }; | |
| 100 #endif | |
| 101 | |
| 102 int quirks() { return quirks_; } | |
| 103 | 86 |
| 104 private: | 87 private: |
| 105 WebPluginDelegateImpl(gfx::NativeView containing_view, | 88 WebPluginDelegateImpl(gfx::NativeView containing_view, |
| 106 NPAPI::PluginInstance *instance); | 89 NPAPI::PluginInstance *instance); |
| 107 ~WebPluginDelegateImpl(); | 90 ~WebPluginDelegateImpl(); |
| 108 | 91 |
| 109 //-------------------------- | 92 //-------------------------- |
| 110 // used for windowed plugins | 93 // used for windowed plugins |
| 111 void WindowedUpdateGeometry(const gfx::Rect& window_rect, | 94 void WindowedUpdateGeometry(const gfx::Rect& window_rect, |
| 112 const gfx::Rect& clip_rect); | 95 const gfx::Rect& clip_rect); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 int y, int reserved, HWND window, | 255 int y, int reserved, HWND window, |
| 273 const RECT* rect); | 256 const RECT* rect); |
| 274 | 257 |
| 275 // SetCursor interceptor for windowless plugins. | 258 // SetCursor interceptor for windowless plugins. |
| 276 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); | 259 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); |
| 277 #endif | 260 #endif |
| 278 | 261 |
| 279 // Holds the current cursor set by the windowless plugin. | 262 // Holds the current cursor set by the windowless plugin. |
| 280 WebCursor current_windowless_cursor_; | 263 WebCursor current_windowless_cursor_; |
| 281 | 264 |
| 265 friend class WebPluginDelegate; |
| 266 |
| 282 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); | 267 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); |
| 283 }; | 268 }; |
| 284 | 269 |
| 285 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ | 270 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
| 286 | |
| OLD | NEW |