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 PPAPI_CPP_DEV_MOUSE_LOCK_DEV_H_ | 5 #ifndef PPAPI_CPP_MOUSE_LOCK_H_ |
6 #define PPAPI_CPP_DEV_MOUSE_LOCK_DEV_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 | 9 |
10 namespace pp { | 10 namespace pp { |
11 | 11 |
12 class CompletionCallback; | 12 class CompletionCallback; |
13 class Instance; | 13 class Instance; |
14 | 14 |
15 // This class allows you to associate the PPP_MouseLock_Dev and | 15 // This class allows you to associate the PPP_MouseLock and PPB_MouseLock |
16 // PPB_MouseLock_Dev C-based interfaces with an object. It associates itself | 16 // C-based interfaces with an object. It associates itself with the given |
17 // with the given instance, and registers as the global handler for handling the | 17 // instance, and registers as the global handler for handling the PPP_MouseLock |
18 // PPP_MouseLock_Dev interface that the browser calls. | 18 // interface that the browser calls. |
19 // | 19 // |
20 // You would typically use this either via inheritance on your instance: | 20 // You would typically use this either via inheritance on your instance: |
21 // class MyInstance : public pp::Instance, public pp::MouseLock_Dev { | 21 // class MyInstance : public pp::Instance, public pp::MouseLock { |
22 // class MyInstance() : pp::MouseLock_Dev(this) { | 22 // class MyInstance() : pp::MouseLock(this) { |
23 // } | 23 // } |
24 // ... | 24 // ... |
25 // }; | 25 // }; |
26 // | 26 // |
27 // or by composition: | 27 // or by composition: |
28 // class MyMouseLock : public pp::MouseLock_Dev { | 28 // class MyMouseLock : public pp::MouseLock { |
29 // ... | 29 // ... |
30 // }; | 30 // }; |
31 // | 31 // |
32 // class MyInstance : public pp::Instance { | 32 // class MyInstance : public pp::Instance { |
33 // MyInstance() : mouse_lock_(this) { | 33 // MyInstance() : mouse_lock_(this) { |
34 // } | 34 // } |
35 // | 35 // |
36 // MyMouseLock mouse_lock_; | 36 // MyMouseLock mouse_lock_; |
37 // }; | 37 // }; |
38 class MouseLock_Dev { | 38 class MouseLock { |
39 public: | 39 public: |
40 explicit MouseLock_Dev(Instance* instance); | 40 explicit MouseLock(Instance* instance); |
41 virtual ~MouseLock_Dev(); | 41 virtual ~MouseLock(); |
42 | 42 |
43 // PPP_MouseLock_Dev functions exposed as virtual functions for you to | 43 // PPP_MouseLock functions exposed as virtual functions for you to override. |
44 // override. | |
45 virtual void MouseLockLost() = 0; | 44 virtual void MouseLockLost() = 0; |
46 | 45 |
47 // PPB_MouseLock_Dev functions for you to call. | 46 // PPB_MouseLock functions for you to call. |
48 int32_t LockMouse(const CompletionCallback& cc); | 47 int32_t LockMouse(const CompletionCallback& cc); |
49 void UnlockMouse(); | 48 void UnlockMouse(); |
50 | 49 |
51 private: | 50 private: |
52 Instance* associated_instance_; | 51 Instance* associated_instance_; |
53 }; | 52 }; |
54 | 53 |
55 } // namespace pp | 54 } // namespace pp |
56 | 55 |
57 #endif // PPAPI_CPP_DEV_MOUSE_LOCK_DEV_H_ | 56 #endif // PPAPI_CPP_MOUSE_LOCK_H_ |
OLD | NEW |