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