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

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

Issue 1815593002: Remove windowed NPAPI code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make_test_plugin_windowless
Patch Set: rebase Created 4 years, 9 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
« no previous file with comments | « content/child/npapi/webplugin.h ('k') | content/child/npapi/webplugin_delegate_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void Paint(SkCanvas* canvas, const gfx::Rect& rect) override; 91 void Paint(SkCanvas* canvas, const gfx::Rect& rect) override;
92 void SetFocus(bool focused) override; 92 void SetFocus(bool focused) override;
93 bool HandleInputEvent(const blink::WebInputEvent& event, 93 bool HandleInputEvent(const blink::WebInputEvent& event,
94 WebCursor::CursorInfo* cursor_info) override; 94 WebCursor::CursorInfo* cursor_info) override;
95 NPObject* GetPluginScriptableObject() override; 95 NPObject* GetPluginScriptableObject() override;
96 NPP GetPluginNPP() override; 96 NPP GetPluginNPP() override;
97 bool GetFormValue(base::string16* value) override; 97 bool GetFormValue(base::string16* value) override;
98 int GetProcessId() override; 98 int GetProcessId() override;
99 // End of WebPluginDelegate implementation. 99 // End of WebPluginDelegate implementation.
100 100
101 gfx::PluginWindowHandle windowed_handle() const { return windowed_handle_; }
102 bool IsWindowless() const { return windowless_; }
103 PluginInstance* instance() { return instance_.get(); } 101 PluginInstance* instance() { return instance_.get(); }
104 gfx::Rect GetRect() const { return window_rect_; } 102 gfx::Rect GetRect() const { return window_rect_; }
105 gfx::Rect GetClipRect() const { return clip_rect_; } 103 gfx::Rect GetClipRect() const { return clip_rect_; }
106 104
107 // Returns the path for the library implementing this plugin. 105 // Returns the path for the library implementing this plugin.
108 base::FilePath GetPluginPath(); 106 base::FilePath GetPluginPath();
109 107
110 // Returns a combination of PluginQuirks. 108 // Returns a combination of PluginQuirks.
111 int GetQuirks() const { return quirks_; } 109 int GetQuirks() const { return quirks_; }
112 110
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 WebPluginDelegateImpl(WebPlugin* plugin, PluginInstance* instance); 168 WebPluginDelegateImpl(WebPlugin* plugin, PluginInstance* instance);
171 ~WebPluginDelegateImpl() override; 169 ~WebPluginDelegateImpl() override;
172 170
173 // Called by Initialize() for platform-specific initialization. 171 // Called by Initialize() for platform-specific initialization.
174 // If this returns false, the plugin shouldn't be started--see Initialize(). 172 // If this returns false, the plugin shouldn't be started--see Initialize().
175 bool PlatformInitialize(); 173 bool PlatformInitialize();
176 174
177 // Called by DestroyInstance(), used for platform-specific destruction. 175 // Called by DestroyInstance(), used for platform-specific destruction.
178 void PlatformDestroyInstance(); 176 void PlatformDestroyInstance();
179 177
180 //--------------------------
181 // used for windowed plugins
182 void WindowedUpdateGeometry(const gfx::Rect& window_rect,
183 const gfx::Rect& clip_rect);
184 // Create the native window.
185 // Returns true if the window is created (or already exists).
186 // Returns false if unable to create the window.
187 bool WindowedCreatePlugin();
188
189 // Destroy the native window.
190 void WindowedDestroyWindow();
191
192 // Reposition the native window to be in sync with the given geometry.
193 // Returns true if the native window has moved or been clipped differently.
194 bool WindowedReposition(const gfx::Rect& window_rect,
195 const gfx::Rect& clip_rect);
196
197 // Tells the plugin about the current state of the window.
198 // See NPAPI NPP_SetWindow for more information.
199 void WindowedSetWindow();
200
201 #if defined(OS_WIN) 178 #if defined(OS_WIN)
202 // Registers the window class for our window
203 ATOM RegisterNativeWindowClass();
204
205 // Our WndProc functions. 179 // Our WndProc functions.
206 static LRESULT CALLBACK WrapperWindowProc(
207 HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
208 static LRESULT CALLBACK NativeWndProc(
209 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
210 static LRESULT CALLBACK FlashWindowlessWndProc( 180 static LRESULT CALLBACK FlashWindowlessWndProc(
211 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); 181 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
212 static LRESULT CALLBACK DummyWindowProc( 182 static LRESULT CALLBACK DummyWindowProc(
213 HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 183 HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
214 184
215 // Used for throttling Flash messages. 185 // Used for throttling Flash messages.
216 static void ClearThrottleQueueForWindow(HWND window); 186 static void ClearThrottleQueueForWindow(HWND window);
217 static void OnThrottleMessage(); 187 static void OnThrottleMessage();
218 static void ThrottleMessage(WNDPROC proc, HWND hwnd, UINT message, 188 static void ThrottleMessage(WNDPROC proc, HWND hwnd, UINT message,
219 WPARAM wParam, LPARAM lParam); 189 WPARAM wParam, LPARAM lParam);
(...skipping 22 matching lines...) Expand all
242 212
243 // Does platform-specific event handling. Arguments and return are identical 213 // Does platform-specific event handling. Arguments and return are identical
244 // to HandleInputEvent. 214 // to HandleInputEvent.
245 bool PlatformHandleInputEvent(const blink::WebInputEvent& event, 215 bool PlatformHandleInputEvent(const blink::WebInputEvent& event,
246 WebCursor::CursorInfo* cursor_info); 216 WebCursor::CursorInfo* cursor_info);
247 217
248 // Closes down and destroys our plugin instance. 218 // Closes down and destroys our plugin instance.
249 void DestroyInstance(); 219 void DestroyInstance();
250 220
251 221
252 // used for windowed plugins
253 // Note: on Mac OS X, the only time the windowed handle is non-zero 222 // Note: on Mac OS X, the only time the windowed handle is non-zero
254 // is the case of accelerated rendering, which uses a fake window handle to 223 // is the case of accelerated rendering, which uses a fake window handle to
255 // identify itself back to the browser. It still performs all of its 224 // identify itself back to the browser. It still performs all of its
256 // work offscreen. 225 // work offscreen.
257 gfx::PluginWindowHandle windowed_handle_;
258 gfx::Rect windowed_last_pos_;
259
260 bool windowed_did_set_window_;
261
262 // used by windowed and windowless plugins
263 bool windowless_;
264 226
265 WebPlugin* plugin_; 227 WebPlugin* plugin_;
266 scoped_refptr<PluginInstance> instance_; 228 scoped_refptr<PluginInstance> instance_;
267 229
268 #if defined(OS_WIN) 230 #if defined(OS_WIN)
269 // Original wndproc before we subclassed.
270 WNDPROC plugin_wnd_proc_;
271
272 // Used to throttle WM_USER+1 messages in Flash.
273 uint32_t last_message_;
274 bool is_calling_wndproc;
275
276 // An IME emulator used by a windowless plugin to retrieve IME data through 231 // An IME emulator used by a windowless plugin to retrieve IME data through
277 // IMM32 functions. 232 // IMM32 functions.
278 scoped_ptr<WebPluginIMEWin> plugin_ime_; 233 scoped_ptr<WebPluginIMEWin> plugin_ime_;
279 #endif // defined(OS_WIN) 234 #endif // defined(OS_WIN)
280 235
281 NPWindow window_; 236 NPWindow window_;
282 gfx::Rect window_rect_; 237 gfx::Rect window_rect_;
283 gfx::Rect clip_rect_; 238 gfx::Rect clip_rect_;
284 int quirks_; 239 int quirks_;
285 240
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 280
326 // GetProcAddress intercepter for windowless plugins. 281 // GetProcAddress intercepter for windowless plugins.
327 static FARPROC WINAPI GetProcAddressPatch(HMODULE module, LPCSTR name); 282 static FARPROC WINAPI GetProcAddressPatch(HMODULE module, LPCSTR name);
328 283
329 // WindowFromPoint patch for Flash windowless plugins. When flash receives 284 // WindowFromPoint patch for Flash windowless plugins. When flash receives
330 // mouse move messages it calls the WindowFromPoint API to eventually convert 285 // mouse move messages it calls the WindowFromPoint API to eventually convert
331 // the mouse coordinates to screen. We need to return the dummy plugin parent 286 // the mouse coordinates to screen. We need to return the dummy plugin parent
332 // window for Aura to ensure that these conversions occur correctly. 287 // window for Aura to ensure that these conversions occur correctly.
333 static HWND WINAPI WindowFromPointPatch(POINT point); 288 static HWND WINAPI WindowFromPointPatch(POINT point);
334 289
335 // The mouse hook proc which handles mouse capture in windowed plugins.
336 static LRESULT CALLBACK MouseHookProc(int code, WPARAM wParam,
337 LPARAM lParam);
338
339 // Calls SetCapture/ReleaseCapture based on the message type.
340 static void HandleCaptureForMessage(HWND window, UINT message);
341
342 #elif defined(OS_MACOSX) && !defined(USE_AURA) 290 #elif defined(OS_MACOSX) && !defined(USE_AURA)
343 // Sets window_rect_ to |rect| 291 // Sets window_rect_ to |rect|
344 void SetPluginRect(const gfx::Rect& rect); 292 void SetPluginRect(const gfx::Rect& rect);
345 // Sets content_area_origin to |origin| 293 // Sets content_area_origin to |origin|
346 void SetContentAreaOrigin(const gfx::Point& origin); 294 void SetContentAreaOrigin(const gfx::Point& origin);
347 // Updates everything that depends on the plugin's absolute screen location. 295 // Updates everything that depends on the plugin's absolute screen location.
348 void PluginScreenLocationChanged(); 296 void PluginScreenLocationChanged();
349 // Updates anything that depends on plugin visibility. 297 // Updates anything that depends on plugin visibility.
350 void PluginVisibilityChanged(); 298 void PluginVisibilityChanged();
351 299
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // Called by the message filter hook when the plugin enters a modal loop. 334 // Called by the message filter hook when the plugin enters a modal loop.
387 void OnModalLoopEntered(); 335 void OnModalLoopEntered();
388 336
389 // Returns true if the message passed in corresponds to a user gesture. 337 // Returns true if the message passed in corresponds to a user gesture.
390 static bool IsUserGesture(const blink::WebInputEvent& event); 338 static bool IsUserGesture(const blink::WebInputEvent& event);
391 339
392 // The url with which the plugin was instantiated. 340 // The url with which the plugin was instantiated.
393 std::string plugin_url_; 341 std::string plugin_url_;
394 342
395 #if defined(OS_WIN) 343 #if defined(OS_WIN)
396 // Indicates the end of a user gesture period.
397 void OnUserGestureEnd();
398
399 // Handle to the message filter hook 344 // Handle to the message filter hook
400 HHOOK handle_event_message_filter_hook_; 345 HHOOK handle_event_message_filter_hook_;
401 346
402 // Event which is set when the plugin enters a modal loop in the course 347 // Event which is set when the plugin enters a modal loop in the course
403 // of a NPP_HandleEvent call. 348 // of a NPP_HandleEvent call.
404 HANDLE handle_event_pump_messages_event_; 349 HANDLE handle_event_pump_messages_event_;
405
406 // This flag indicates whether we started tracking a user gesture message.
407 bool user_gesture_message_posted_;
408
409 // Handle to the mouse hook installed for certain windowed plugins like
410 // flash.
411 HHOOK mouse_hook_;
412 #endif 350 #endif
413 351
414 // Holds the depth of the HandleEvent callstack. 352 // Holds the depth of the HandleEvent callstack.
415 int handle_event_depth_; 353 int handle_event_depth_;
416 354
417 // Holds the current cursor set by the windowless plugin. 355 // Holds the current cursor set by the windowless plugin.
418 WebCursor current_windowless_cursor_; 356 WebCursor current_windowless_cursor_;
419 357
420 // Set to true initially and indicates if this is the first npp_setwindow 358 // Set to true initially and indicates if this is the first npp_setwindow
421 // call received by the plugin. 359 // call received by the plugin.
(...skipping 18 matching lines...) Expand all
440 // asynchronously. 378 // asynchronously.
441 base::WeakPtrFactory<WebPluginDelegateImpl> user_gesture_msg_factory_; 379 base::WeakPtrFactory<WebPluginDelegateImpl> user_gesture_msg_factory_;
442 #endif 380 #endif
443 381
444 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); 382 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl);
445 }; 383 };
446 384
447 } // namespace content 385 } // namespace content
448 386
449 #endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ 387 #endif // CONTENT_CHILD_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_
OLDNEW
« no previous file with comments | « content/child/npapi/webplugin.h ('k') | content/child/npapi/webplugin_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698