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

Side by Side Diff: content/renderer/pepper_plugin_delegate_impl.h

Issue 8970016: refactoring mouse lock to support pepper and WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated webkit API names. Created 8 years, 11 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 CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 bool CanComposeInline() const; 190 bool CanComposeInline() const;
191 191
192 // IME events. 192 // IME events.
193 void OnImeSetComposition( 193 void OnImeSetComposition(
194 const string16& text, 194 const string16& text,
195 const std::vector<WebKit::WebCompositionUnderline>& underlines, 195 const std::vector<WebKit::WebCompositionUnderline>& underlines,
196 int selection_start, 196 int selection_start,
197 int selection_end); 197 int selection_end);
198 void OnImeConfirmComposition(const string16& text); 198 void OnImeConfirmComposition(const string16& text);
199 199
200 // Notification that the request to lock the mouse has completed.
201 void OnLockMouseACK(bool succeeded);
202 // Notification that the plugin instance has lost the mouse lock.
203 void OnMouseLockLost();
204 // Notification that a mouse event has arrived at the render view. 200 // Notification that a mouse event has arrived at the render view.
205 // Returns true if no further handling is needed. For example, if the mouse is 201 void WillHandleMouseEvent();
206 // currently locked, this method directly dispatches the event to the owner of
207 // the mouse lock and returns true.
208 bool HandleMouseEvent(const WebKit::WebMouseEvent& event);
209 202
210 // PluginDelegate implementation. 203 // PluginDelegate implementation.
211 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, 204 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance,
212 bool focused) OVERRIDE; 205 bool focused) OVERRIDE;
213 virtual void PluginTextInputTypeChanged( 206 virtual void PluginTextInputTypeChanged(
214 webkit::ppapi::PluginInstance* instance) OVERRIDE; 207 webkit::ppapi::PluginInstance* instance) OVERRIDE;
215 virtual void PluginCaretPositionChanged( 208 virtual void PluginCaretPositionChanged(
216 webkit::ppapi::PluginInstance* instance) OVERRIDE; 209 webkit::ppapi::PluginInstance* instance) OVERRIDE;
217 virtual void PluginRequestedCancelComposition( 210 virtual void PluginRequestedCancelComposition(
218 webkit::ppapi::PluginInstance* instance) OVERRIDE; 211 webkit::ppapi::PluginInstance* instance) OVERRIDE;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 virtual void DidStartLoading() OVERRIDE; 369 virtual void DidStartLoading() OVERRIDE;
377 virtual void DidStopLoading() OVERRIDE; 370 virtual void DidStopLoading() OVERRIDE;
378 virtual void SetContentRestriction(int restrictions) OVERRIDE; 371 virtual void SetContentRestriction(int restrictions) OVERRIDE;
379 virtual void SaveURLAs(const GURL& url) OVERRIDE; 372 virtual void SaveURLAs(const GURL& url) OVERRIDE;
380 virtual webkit_glue::P2PTransport* CreateP2PTransport() OVERRIDE; 373 virtual webkit_glue::P2PTransport* CreateP2PTransport() OVERRIDE;
381 virtual double GetLocalTimeZoneOffset(base::Time t) OVERRIDE; 374 virtual double GetLocalTimeZoneOffset(base::Time t) OVERRIDE;
382 virtual std::string GetFlashCommandLineArgs() OVERRIDE; 375 virtual std::string GetFlashCommandLineArgs() OVERRIDE;
383 virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size) 376 virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size)
384 OVERRIDE; 377 OVERRIDE;
385 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; 378 virtual ::ppapi::Preferences GetPreferences() OVERRIDE;
386 virtual void LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; 379 virtual bool LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE;
387 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; 380 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE;
381 virtual bool IsMouseLocked(webkit::ppapi::PluginInstance* instance) OVERRIDE;
388 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, 382 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance,
389 const WebKit::WebCursorInfo& cursor) OVERRIDE; 383 const WebKit::WebCursorInfo& cursor) OVERRIDE;
390 virtual void DidReceiveMouseEvent( 384 virtual void DidReceiveMouseEvent(
391 webkit::ppapi::PluginInstance* instance) OVERRIDE; 385 webkit::ppapi::PluginInstance* instance) OVERRIDE;
392 virtual bool IsInFullscreenMode() OVERRIDE; 386 virtual bool IsInFullscreenMode() OVERRIDE;
393 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; 387 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE;
394 virtual bool IsPageVisible() const OVERRIDE; 388 virtual bool IsPageVisible() const OVERRIDE;
395 389
396 // RenderViewObserver implementation. 390 // RenderViewObserver implementation.
397 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 391 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
(...skipping 28 matching lines...) Expand all
426 const std::string& data, 420 const std::string& data,
427 const PP_NetAddress_Private& addr); 421 const PP_NetAddress_Private& addr);
428 422
429 CONTENT_EXPORT int GetRoutingId() const; 423 CONTENT_EXPORT int GetRoutingId() const;
430 424
431 private: 425 private:
432 // Asynchronously attempts to create a PPAPI broker for the given plugin. 426 // Asynchronously attempts to create a PPAPI broker for the given plugin.
433 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( 427 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker(
434 webkit::ppapi::PluginModule* plugin_module); 428 webkit::ppapi::PluginModule* plugin_module);
435 429
436 bool MouseLockedOrPending() const {
437 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_;
438 }
439
440 // Implementation of PepperParentContextProvider. 430 // Implementation of PepperParentContextProvider.
441 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; 431 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE;
442 432
443 // Helper function to check that TCP/UDP private APIs are allowed for current 433 // Helper function to check that TCP/UDP private APIs are allowed for current
444 // page. This check actually allows socket usage for NativeClient code only. 434 // page. This check actually allows socket usage for NativeClient code only.
445 // It is better to move this check to browser process but Pepper message 435 // It is better to move this check to browser process but Pepper message
446 // filters in browser process have no context about page that sent 436 // filters in browser process have no context about page that sent
447 // the request. Doing this check in render process is safe because NaCl code 437 // the request. Doing this check in render process is safe because NaCl code
448 // is executed in separate NaCl process. 438 // is executed in separate NaCl process.
449 // TODO(dpolukhin, yzshen): make the check consistent for in- and out-process 439 // TODO(dpolukhin, yzshen): make the check consistent for in- and out-process
(...skipping 24 matching lines...) Expand all
474 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; 464 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap;
475 BrokerMap pending_connect_broker_; 465 BrokerMap pending_connect_broker_;
476 466
477 // Whether or not the focus is on a PPAPI plugin 467 // Whether or not the focus is on a PPAPI plugin
478 webkit::ppapi::PluginInstance* focused_plugin_; 468 webkit::ppapi::PluginInstance* focused_plugin_;
479 469
480 // Current text input composition text. Empty if no composition is in 470 // Current text input composition text. Empty if no composition is in
481 // progress. 471 // progress.
482 string16 composition_text_; 472 string16 composition_text_;
483 473
484 // |mouse_lock_owner_| is not owned by this class. We can know about when it
485 // is destroyed via InstanceDeleted().
486 // |mouse_lock_owner_| being non-NULL doesn't indicate that currently the
487 // mouse has been locked. It is possible that a request to lock the mouse has
488 // been sent, but the response hasn't arrived yet.
489 webkit::ppapi::PluginInstance* mouse_lock_owner_;
490 bool mouse_locked_;
491 // If both |pending_lock_request_| and |pending_unlock_request_| are true,
492 // it means a lock request was sent before an unlock request and we haven't
493 // received responses for them.
494 // The logic in LockMouse() makes sure that a lock request won't be sent when
495 // there is a pending unlock request.
496 bool pending_lock_request_;
497 bool pending_unlock_request_;
498
499 // The plugin instance that received the last mouse event. It is set to NULL 474 // The plugin instance that received the last mouse event. It is set to NULL
500 // if the last mouse event went to elements other than Pepper plugins. 475 // if the last mouse event went to elements other than Pepper plugins.
501 // |last_mouse_event_target_| is not owned by this class. We can know about 476 // |last_mouse_event_target_| is not owned by this class. We can know about
502 // when it is destroyed via InstanceDeleted(). 477 // when it is destroyed via InstanceDeleted().
503 webkit::ppapi::PluginInstance* last_mouse_event_target_; 478 webkit::ppapi::PluginInstance* last_mouse_event_target_;
504 479
505 scoped_ptr<content::GamepadSharedMemoryReader> gamepad_shared_memory_reader_; 480 scoped_ptr<content::GamepadSharedMemoryReader> gamepad_shared_memory_reader_;
506 481
507 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); 482 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl);
508 }; 483 };
509 484
510 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ 485 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698