| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool CanComposeInline() const; | 182 bool CanComposeInline() const; |
| 183 | 183 |
| 184 // IME events. | 184 // IME events. |
| 185 void OnImeSetComposition( | 185 void OnImeSetComposition( |
| 186 const string16& text, | 186 const string16& text, |
| 187 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 187 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| 188 int selection_start, | 188 int selection_start, |
| 189 int selection_end); | 189 int selection_end); |
| 190 void OnImeConfirmComposition(const string16& text); | 190 void OnImeConfirmComposition(const string16& text); |
| 191 | 191 |
| 192 // Notification that the request to lock the mouse has completed. | |
| 193 void OnLockMouseACK(bool succeeded); | |
| 194 // Notification that the plugin instance has lost the mouse lock. | |
| 195 void OnMouseLockLost(); | |
| 196 // Notification that a mouse event has arrived at the render view. | 192 // Notification that a mouse event has arrived at the render view. |
| 197 // Returns true if no further handling is needed. For example, if the mouse is | 193 void WillHandleMouseEvent(); |
| 198 // currently locked, this method directly dispatches the event to the owner of | |
| 199 // the mouse lock and returns true. | |
| 200 bool HandleMouseEvent(const WebKit::WebMouseEvent& event); | |
| 201 | 194 |
| 202 // PluginDelegate implementation. | 195 // PluginDelegate implementation. |
| 203 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, | 196 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, |
| 204 bool focused) OVERRIDE; | 197 bool focused) OVERRIDE; |
| 205 virtual void PluginTextInputTypeChanged( | 198 virtual void PluginTextInputTypeChanged( |
| 206 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 199 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 207 virtual void PluginCaretPositionChanged( | 200 virtual void PluginCaretPositionChanged( |
| 208 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 201 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 209 virtual void PluginRequestedCancelComposition( | 202 virtual void PluginRequestedCancelComposition( |
| 210 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 203 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 virtual void DidStartLoading() OVERRIDE; | 361 virtual void DidStartLoading() OVERRIDE; |
| 369 virtual void DidStopLoading() OVERRIDE; | 362 virtual void DidStopLoading() OVERRIDE; |
| 370 virtual void SetContentRestriction(int restrictions) OVERRIDE; | 363 virtual void SetContentRestriction(int restrictions) OVERRIDE; |
| 371 virtual void SaveURLAs(const GURL& url) OVERRIDE; | 364 virtual void SaveURLAs(const GURL& url) OVERRIDE; |
| 372 virtual webkit_glue::P2PTransport* CreateP2PTransport() OVERRIDE; | 365 virtual webkit_glue::P2PTransport* CreateP2PTransport() OVERRIDE; |
| 373 virtual double GetLocalTimeZoneOffset(base::Time t) OVERRIDE; | 366 virtual double GetLocalTimeZoneOffset(base::Time t) OVERRIDE; |
| 374 virtual std::string GetFlashCommandLineArgs() OVERRIDE; | 367 virtual std::string GetFlashCommandLineArgs() OVERRIDE; |
| 375 virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size) | 368 virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size) |
| 376 OVERRIDE; | 369 OVERRIDE; |
| 377 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; | 370 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; |
| 378 virtual void LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; | 371 virtual bool LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 379 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; | 372 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 380 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, | 373 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, |
| 381 const WebKit::WebCursorInfo& cursor) OVERRIDE; | 374 const WebKit::WebCursorInfo& cursor) OVERRIDE; |
| 382 virtual void DidReceiveMouseEvent( | 375 virtual void DidReceiveMouseEvent( |
| 383 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 376 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 384 virtual bool IsInFullscreenMode() OVERRIDE; | 377 virtual bool IsInFullscreenMode() OVERRIDE; |
| 385 | 378 |
| 386 // RenderViewObserver implementation. | 379 // RenderViewObserver implementation. |
| 387 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 380 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 388 virtual void OnDestruct() OVERRIDE; | 381 virtual void OnDestruct() OVERRIDE; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 416 const std::string& data, | 409 const std::string& data, |
| 417 const PP_NetAddress_Private& addr); | 410 const PP_NetAddress_Private& addr); |
| 418 | 411 |
| 419 CONTENT_EXPORT int GetRoutingId() const; | 412 CONTENT_EXPORT int GetRoutingId() const; |
| 420 | 413 |
| 421 private: | 414 private: |
| 422 // Asynchronously attempts to create a PPAPI broker for the given plugin. | 415 // Asynchronously attempts to create a PPAPI broker for the given plugin. |
| 423 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( | 416 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( |
| 424 webkit::ppapi::PluginModule* plugin_module); | 417 webkit::ppapi::PluginModule* plugin_module); |
| 425 | 418 |
| 426 bool MouseLockedOrPending() const { | |
| 427 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; | |
| 428 } | |
| 429 | |
| 430 // Implementation of PepperParentContextProvider. | 419 // Implementation of PepperParentContextProvider. |
| 431 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; | 420 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; |
| 432 | 421 |
| 433 // Helper function to check that TCP/UDP private APIs are allowed for current | 422 // Helper function to check that TCP/UDP private APIs are allowed for current |
| 434 // page. This check actually allows socket usage for NativeClient code only. | 423 // page. This check actually allows socket usage for NativeClient code only. |
| 435 // It is better to move this check to browser process but Pepper message | 424 // It is better to move this check to browser process but Pepper message |
| 436 // filters in browser process have no context about page that sent | 425 // filters in browser process have no context about page that sent |
| 437 // the request. Doing this check in render process is safe because NaCl code | 426 // the request. Doing this check in render process is safe because NaCl code |
| 438 // is executed in separate NaCl process. | 427 // is executed in separate NaCl process. |
| 439 // TODO(dpolukhin, yzshen): make the check consistent for in- and out-process | 428 // TODO(dpolukhin, yzshen): make the check consistent for in- and out-process |
| (...skipping 24 matching lines...) Expand all Loading... |
| 464 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; | 453 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; |
| 465 BrokerMap pending_connect_broker_; | 454 BrokerMap pending_connect_broker_; |
| 466 | 455 |
| 467 // Whether or not the focus is on a PPAPI plugin | 456 // Whether or not the focus is on a PPAPI plugin |
| 468 webkit::ppapi::PluginInstance* focused_plugin_; | 457 webkit::ppapi::PluginInstance* focused_plugin_; |
| 469 | 458 |
| 470 // Current text input composition text. Empty if no composition is in | 459 // Current text input composition text. Empty if no composition is in |
| 471 // progress. | 460 // progress. |
| 472 string16 composition_text_; | 461 string16 composition_text_; |
| 473 | 462 |
| 474 // |mouse_lock_owner_| is not owned by this class. We can know about when it | |
| 475 // is destroyed via InstanceDeleted(). | |
| 476 // |mouse_lock_owner_| being non-NULL doesn't indicate that currently the | |
| 477 // mouse has been locked. It is possible that a request to lock the mouse has | |
| 478 // been sent, but the response hasn't arrived yet. | |
| 479 webkit::ppapi::PluginInstance* mouse_lock_owner_; | |
| 480 bool mouse_locked_; | |
| 481 // If both |pending_lock_request_| and |pending_unlock_request_| are true, | |
| 482 // it means a lock request was sent before an unlock request and we haven't | |
| 483 // received responses for them. | |
| 484 // The logic in LockMouse() makes sure that a lock request won't be sent when | |
| 485 // there is a pending unlock request. | |
| 486 bool pending_lock_request_; | |
| 487 bool pending_unlock_request_; | |
| 488 | |
| 489 // The plugin instance that received the last mouse event. It is set to NULL | 463 // The plugin instance that received the last mouse event. It is set to NULL |
| 490 // if the last mouse event went to elements other than Pepper plugins. | 464 // if the last mouse event went to elements other than Pepper plugins. |
| 491 // |last_mouse_event_target_| is not owned by this class. We can know about | 465 // |last_mouse_event_target_| is not owned by this class. We can know about |
| 492 // when it is destroyed via InstanceDeleted(). | 466 // when it is destroyed via InstanceDeleted(). |
| 493 webkit::ppapi::PluginInstance* last_mouse_event_target_; | 467 webkit::ppapi::PluginInstance* last_mouse_event_target_; |
| 494 | 468 |
| 495 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 469 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
| 496 }; | 470 }; |
| 497 | 471 |
| 498 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 472 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
| OLD | NEW |