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