| 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 PPAPI_CPP_MOUSE_LOCK_H_ | 5 #ifndef PPAPI_CPP_MOUSE_LOCK_H_ |
| 6 #define PPAPI_CPP_MOUSE_LOCK_H_ | 6 #define PPAPI_CPP_MOUSE_LOCK_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
| 9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
| 10 | 10 |
| 11 /// @file | 11 /// @file |
| 12 /// This file defines the API for locking the target of mouse events to a | 12 /// This file defines the API for locking the target of mouse events to a |
| 13 /// specific module instance. | 13 /// specific module instance. |
| 14 | 14 |
| 15 namespace pp { | 15 namespace pp { |
| 16 | 16 |
| 17 class CompletionCallback; | 17 class CompletionCallback; |
| 18 class Instance; | 18 class Instance; |
| 19 | 19 |
| 20 /// This class allows you to associate the <code>PPP_MouseLock</code> and | 20 /// This class allows you to associate the <code>PPP_MouseLock</code> and |
| 21 /// <code>PPB_MouseLock</code> C-based interfaces with an object. It associates | 21 /// <code>PPB_MouseLock</code> C-based interfaces with an object. It associates |
| 22 /// itself with the given instance, and registers as the global handler for | 22 /// itself with the given instance, and registers as the global handler for |
| 23 /// handling the <code>PPP_MouseLock</code> interface that the browser calls. | 23 /// handling the <code>PPP_MouseLock</code> interface that the browser calls. |
| 24 /// | 24 /// |
| 25 /// You would typically use this class by inheritance on your instance or by | 25 /// You would typically use this class by inheritance on your instance or by |
| 26 /// composition. | 26 /// composition. |
| 27 /// | 27 /// |
| 28 /// <strong>Example (inheritance):</strong> | 28 /// <strong>Example (inheritance):</strong> |
| 29 /// <code> | 29 /// @code |
| 30 /// class MyInstance : public pp::Instance, public pp::MouseLock { | 30 /// class MyInstance : public pp::Instance, public pp::MouseLock { |
| 31 /// class MyInstance() : pp::MouseLock(this) { | 31 /// class MyInstance() : pp::MouseLock(this) { |
| 32 /// } | 32 /// } |
| 33 /// ... | 33 /// ... |
| 34 /// }; | 34 /// }; |
| 35 /// </code> | 35 /// @endcode |
| 36 /// | 36 /// |
| 37 /// <strong>Example (composition):</strong> | 37 /// <strong>Example (composition):</strong> |
| 38 /// <code> | 38 /// @code |
| 39 /// class MyMouseLock : public pp::MouseLock { | 39 /// class MyMouseLock : public pp::MouseLock { |
| 40 /// ... | 40 /// ... |
| 41 /// }; | 41 /// }; |
| 42 /// | 42 /// |
| 43 /// class MyInstance : public pp::Instance { | 43 /// class MyInstance : public pp::Instance { |
| 44 /// MyInstance() : mouse_lock_(this) { | 44 /// MyInstance() : mouse_lock_(this) { |
| 45 /// } | 45 /// } |
| 46 /// | 46 /// |
| 47 /// MyMouseLock mouse_lock_; | 47 /// MyMouseLock mouse_lock_; |
| 48 /// }; | 48 /// }; |
| 49 /// </code> | 49 /// @endcode |
| 50 class MouseLock { | 50 class MouseLock { |
| 51 public: | 51 public: |
| 52 /// A constructor for creating a <code>MouseLock</code>. | 52 /// A constructor for creating a <code>MouseLock</code>. |
| 53 /// | 53 /// |
| 54 /// @param[in] instance The instance with which this resource will be | 54 /// @param[in] instance The instance with which this resource will be |
| 55 /// associated. | 55 /// associated. |
| 56 explicit MouseLock(Instance* instance); | 56 explicit MouseLock(Instance* instance); |
| 57 | 57 |
| 58 /// Destructor. | 58 /// Destructor. |
| 59 virtual ~MouseLock(); | 59 virtual ~MouseLock(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 /// has lost the mouse lock. | 89 /// has lost the mouse lock. |
| 90 void UnlockMouse(); | 90 void UnlockMouse(); |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 InstanceHandle associated_instance_; | 93 InstanceHandle associated_instance_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace pp | 96 } // namespace pp |
| 97 | 97 |
| 98 #endif // PPAPI_CPP_MOUSE_LOCK_H_ | 98 #endif // PPAPI_CPP_MOUSE_LOCK_H_ |
| OLD | NEW |