OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_ZOOM_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_ZOOM_DEV_H_ |
6 #define PPAPI_CPP_DEV_ZOOM_DEV_H_ | 6 #define PPAPI_CPP_DEV_ZOOM_DEV_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/dev/ppp_zoom_dev.h" | 10 #include "ppapi/c/dev/ppp_zoom_dev.h" |
| 11 #include "ppapi/cpp/instance_handle.h" |
11 | 12 |
12 namespace pp { | 13 namespace pp { |
13 | 14 |
14 class Instance; | |
15 | |
16 // This class allows you to associate the PPP_Zoom_Dev and PPB_Zoom_Dev C-based | 15 // This class allows you to associate the PPP_Zoom_Dev and PPB_Zoom_Dev C-based |
17 // interfaces with an object. It associates itself with the given instance, and | 16 // interfaces with an object. It associates itself with the given instance, and |
18 // registers as the global handler for handling the PPP_Zoom_Dev interface that | 17 // registers as the global handler for handling the PPP_Zoom_Dev interface that |
19 // the browser calls. | 18 // the browser calls. |
20 // | 19 // |
21 // You would typically use this either via inheritance on your instance: | 20 // You would typically use this either via inheritance on your instance: |
22 // class MyInstance : public pp::Instance, public pp::Zoom_Dev { | 21 // class MyInstance : public pp::Instance, public pp::Zoom_Dev { |
23 // class MyInstance() : pp::Zoom_Dev(this) { | 22 // class MyInstance() : pp::Zoom_Dev(this) { |
24 // } | 23 // } |
25 // ... | 24 // ... |
26 // }; | 25 // }; |
27 // | 26 // |
28 // or by composition: | 27 // or by composition: |
29 // class MyZoom : public pp::Zoom_Dev { | 28 // class MyZoom : public pp::Zoom_Dev { |
30 // ... | 29 // ... |
31 // }; | 30 // }; |
32 // | 31 // |
33 // class MyInstance : public pp::Instance { | 32 // class MyInstance : public pp::Instance { |
34 // MyInstance() : zoom_(this) { | 33 // MyInstance() : zoom_(this) { |
35 // } | 34 // } |
36 // | 35 // |
37 // MyZoom zoom_; | 36 // MyZoom zoom_; |
38 // }; | 37 // }; |
39 class Zoom_Dev { | 38 class Zoom_Dev { |
40 public: | 39 public: |
41 Zoom_Dev(Instance* instance); | 40 explicit Zoom_Dev(const InstanceHandle& instance); |
42 virtual ~Zoom_Dev(); | 41 virtual ~Zoom_Dev(); |
43 | 42 |
44 // PPP_Zoom_Dev functions exposed as virtual functions for you to | 43 // PPP_Zoom_Dev functions exposed as virtual functions for you to |
45 // override. | 44 // override. |
46 virtual void Zoom(double factor, bool text_only) = 0; | 45 virtual void Zoom(double factor, bool text_only) = 0; |
47 | 46 |
48 // PPB_Zoom_Def functions for you to call to report new zoom factor. | 47 // PPB_Zoom_Def functions for you to call to report new zoom factor. |
49 void ZoomChanged(double factor); | 48 void ZoomChanged(double factor); |
50 void ZoomLimitsChanged(double minimum_factor, double maximium_factor); | 49 void ZoomLimitsChanged(double minimum_factor, double maximium_factor); |
51 | 50 |
52 private: | 51 private: |
53 Instance* associated_instance_; | 52 InstanceHandle associated_instance_; |
54 }; | 53 }; |
55 | 54 |
56 } // namespace pp | 55 } // namespace pp |
57 | 56 |
58 #endif // PPAPI_CPP_DEV_ZOOM_DEV_H_ | 57 #endif // PPAPI_CPP_DEV_ZOOM_DEV_H_ |
OLD | NEW |