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