| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. | 78 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. |
| 79 PLUGIN_QUIRK_EMULATE_IME = 131072, // Windows. | 79 PLUGIN_QUIRK_EMULATE_IME = 131072, // Windows. |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 static WebPluginDelegateImpl* Create(const base::FilePath& filename, | 82 static WebPluginDelegateImpl* Create(const base::FilePath& filename, |
| 83 const std::string& mime_type); | 83 const std::string& mime_type); |
| 84 | 84 |
| 85 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
| 86 static bool IsPluginDelegateWindow(HWND window); | 86 static bool IsPluginDelegateWindow(HWND window); |
| 87 static bool GetPluginNameFromWindow(HWND window, | 87 static bool GetPluginNameFromWindow(HWND window, |
| 88 string16* plugin_name); | 88 base::string16* plugin_name); |
| 89 static bool GetPluginVersionFromWindow(HWND window, | 89 static bool GetPluginVersionFromWindow(HWND window, |
| 90 string16* plugin_version); | 90 base::string16* plugin_version); |
| 91 | 91 |
| 92 // Returns true if the window handle passed in is that of the dummy | 92 // Returns true if the window handle passed in is that of the dummy |
| 93 // activation window for windowless plugins. | 93 // activation window for windowless plugins. |
| 94 static bool IsDummyActivationWindow(HWND window); | 94 static bool IsDummyActivationWindow(HWND window); |
| 95 | 95 |
| 96 // Returns the default HWND to parent the windowed plugins and dummy windows | 96 // Returns the default HWND to parent the windowed plugins and dummy windows |
| 97 // for activation to when none isavailable. | 97 // for activation to when none isavailable. |
| 98 static HWND GetDefaultWindowParent(); | 98 static HWND GetDefaultWindowParent(); |
| 99 #endif | 99 #endif |
| 100 | 100 |
| 101 // WebPluginDelegate implementation | 101 // WebPluginDelegate implementation |
| 102 virtual bool Initialize(const GURL& url, | 102 virtual bool Initialize(const GURL& url, |
| 103 const std::vector<std::string>& arg_names, | 103 const std::vector<std::string>& arg_names, |
| 104 const std::vector<std::string>& arg_values, | 104 const std::vector<std::string>& arg_values, |
| 105 WebPlugin* plugin, | 105 WebPlugin* plugin, |
| 106 bool load_manually) OVERRIDE; | 106 bool load_manually) OVERRIDE; |
| 107 virtual void PluginDestroyed() OVERRIDE; | 107 virtual void PluginDestroyed() OVERRIDE; |
| 108 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 108 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
| 109 const gfx::Rect& clip_rect) OVERRIDE; | 109 const gfx::Rect& clip_rect) OVERRIDE; |
| 110 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE; | 110 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE; |
| 111 virtual void SetFocus(bool focused) OVERRIDE; | 111 virtual void SetFocus(bool focused) OVERRIDE; |
| 112 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, | 112 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| 113 WebKit::WebCursorInfo* cursor_info) OVERRIDE; | 113 WebKit::WebCursorInfo* cursor_info) OVERRIDE; |
| 114 virtual NPObject* GetPluginScriptableObject() OVERRIDE; | 114 virtual NPObject* GetPluginScriptableObject() OVERRIDE; |
| 115 virtual bool GetFormValue(string16* value) OVERRIDE; | 115 virtual bool GetFormValue(base::string16* value) OVERRIDE; |
| 116 virtual void DidFinishLoadWithReason(const GURL& url, | 116 virtual void DidFinishLoadWithReason(const GURL& url, |
| 117 NPReason reason, | 117 NPReason reason, |
| 118 int notify_id) OVERRIDE; | 118 int notify_id) OVERRIDE; |
| 119 virtual int GetProcessId() OVERRIDE; | 119 virtual int GetProcessId() OVERRIDE; |
| 120 virtual void SendJavaScriptStream(const GURL& url, | 120 virtual void SendJavaScriptStream(const GURL& url, |
| 121 const std::string& result, | 121 const std::string& result, |
| 122 bool success, | 122 bool success, |
| 123 int notify_id) OVERRIDE; | 123 int notify_id) OVERRIDE; |
| 124 virtual void DidReceiveManualResponse(const GURL& url, | 124 virtual void DidReceiveManualResponse(const GURL& url, |
| 125 const std::string& mime_type, | 125 const std::string& mime_type, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 145 base::FilePath GetPluginPath(); | 145 base::FilePath GetPluginPath(); |
| 146 | 146 |
| 147 // Returns a combination of PluginQuirks. | 147 // Returns a combination of PluginQuirks. |
| 148 int GetQuirks() const { return quirks_; } | 148 int GetQuirks() const { return quirks_; } |
| 149 | 149 |
| 150 // Informs the plugin that the view it is in has gained or lost focus. | 150 // Informs the plugin that the view it is in has gained or lost focus. |
| 151 void SetContentAreaHasFocus(bool has_focus); | 151 void SetContentAreaHasFocus(bool has_focus); |
| 152 | 152 |
| 153 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
| 154 // Informs the plug-in that an IME has changed its status. | 154 // Informs the plug-in that an IME has changed its status. |
| 155 void ImeCompositionUpdated(const string16& text, | 155 void ImeCompositionUpdated(const base::string16& text, |
| 156 const std::vector<int>& clauses, | 156 const std::vector<int>& clauses, |
| 157 const std::vector<int>& target, | 157 const std::vector<int>& target, |
| 158 int cursor_position); | 158 int cursor_position); |
| 159 | 159 |
| 160 // Informs the plugin that IME composition has completed./ If |text| is empty, | 160 // Informs the plugin that IME composition has completed./ If |text| is empty, |
| 161 // IME was cancelled. | 161 // IME was cancelled. |
| 162 void ImeCompositionCompleted(const string16& text); | 162 void ImeCompositionCompleted(const base::string16& text); |
| 163 | 163 |
| 164 // Returns the IME status retrieved from a plug-in. | 164 // Returns the IME status retrieved from a plug-in. |
| 165 bool GetIMEStatus(int* input_type, gfx::Rect* caret_rect); | 165 bool GetIMEStatus(int* input_type, gfx::Rect* caret_rect); |
| 166 #endif | 166 #endif |
| 167 | 167 |
| 168 #if defined(OS_MACOSX) && !defined(USE_AURA) | 168 #if defined(OS_MACOSX) && !defined(USE_AURA) |
| 169 // Informs the plugin that the geometry has changed, as with UpdateGeometry, | 169 // Informs the plugin that the geometry has changed, as with UpdateGeometry, |
| 170 // but also includes the new buffer context for that new geometry. | 170 // but also includes the new buffer context for that new geometry. |
| 171 void UpdateGeometryAndContext(const gfx::Rect& window_rect, | 171 void UpdateGeometryAndContext(const gfx::Rect& window_rect, |
| 172 const gfx::Rect& clip_rect, | 172 const gfx::Rect& clip_rect, |
| 173 gfx::NativeDrawingContext context); | 173 gfx::NativeDrawingContext context); |
| 174 // Informs the delegate that the plugin called NPN_Invalidate*. Used as a | 174 // Informs the delegate that the plugin called NPN_Invalidate*. Used as a |
| 175 // trigger for Core Animation drawing. | 175 // trigger for Core Animation drawing. |
| 176 void PluginDidInvalidate(); | 176 void PluginDidInvalidate(); |
| 177 // Returns the delegate currently processing events. | 177 // Returns the delegate currently processing events. |
| 178 static WebPluginDelegateImpl* GetActiveDelegate(); | 178 static WebPluginDelegateImpl* GetActiveDelegate(); |
| 179 // Informs the plugin that the window it is in has gained or lost focus. | 179 // Informs the plugin that the window it is in has gained or lost focus. |
| 180 void SetWindowHasFocus(bool has_focus); | 180 void SetWindowHasFocus(bool has_focus); |
| 181 // Informs the plugin that its tab or window has been hidden or shown. | 181 // Informs the plugin that its tab or window has been hidden or shown. |
| 182 void SetContainerVisibility(bool is_visible); | 182 void SetContainerVisibility(bool is_visible); |
| 183 // Informs the plugin that its containing window's frame has changed. | 183 // Informs the plugin that its containing window's frame has changed. |
| 184 // Frames are in screen coordinates. | 184 // Frames are in screen coordinates. |
| 185 void WindowFrameChanged(const gfx::Rect& window_frame, | 185 void WindowFrameChanged(const gfx::Rect& window_frame, |
| 186 const gfx::Rect& view_frame); | 186 const gfx::Rect& view_frame); |
| 187 // Informs the plugin that IME composition has completed. | 187 // Informs the plugin that IME composition has completed. |
| 188 // If |text| is empty, IME was cancelled. | 188 // If |text| is empty, IME was cancelled. |
| 189 void ImeCompositionCompleted(const string16& text); | 189 void ImeCompositionCompleted(const base::string16& text); |
| 190 // Informs the delegate that the plugin set a Cocoa NSCursor. | 190 // Informs the delegate that the plugin set a Cocoa NSCursor. |
| 191 void SetNSCursor(NSCursor* cursor); | 191 void SetNSCursor(NSCursor* cursor); |
| 192 | 192 |
| 193 // Indicates that the windowless plugins will draw directly to the window | 193 // Indicates that the windowless plugins will draw directly to the window |
| 194 // context instead of a buffer context. | 194 // context instead of a buffer context. |
| 195 void SetNoBufferContext(); | 195 void SetNoBufferContext(); |
| 196 | 196 |
| 197 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia | 197 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia |
| 198 // port to share code with the Darwin / CG port. Later, this will be removed | 198 // port to share code with the Darwin / CG port. Later, this will be removed |
| 199 // and all callers will use the Paint defined above. | 199 // and all callers will use the Paint defined above. |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 // True if NPP_New did not return an error. | 497 // True if NPP_New did not return an error. |
| 498 bool creation_succeeded_; | 498 bool creation_succeeded_; |
| 499 | 499 |
| 500 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); | 500 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); |
| 501 }; | 501 }; |
| 502 | 502 |
| 503 } // namespace npapi | 503 } // namespace npapi |
| 504 } // namespace webkit | 504 } // namespace webkit |
| 505 | 505 |
| 506 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ | 506 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ |
| OLD | NEW |