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 #include "ppapi/cpp/dev/zoom_dev.h" | 5 #include "ppapi/cpp/dev/zoom_dev.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_zoom_dev.h" | 7 #include "ppapi/c/dev/ppb_zoom_dev.h" |
8 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const PPP_Zoom_Dev ppp_zoom = { | 28 const PPP_Zoom_Dev ppp_zoom = { |
29 &Zoom | 29 &Zoom |
30 }; | 30 }; |
31 | 31 |
32 template <> const char* interface_name<PPB_Zoom_Dev>() { | 32 template <> const char* interface_name<PPB_Zoom_Dev>() { |
33 return PPB_ZOOM_DEV_INTERFACE; | 33 return PPB_ZOOM_DEV_INTERFACE; |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 Zoom_Dev::Zoom_Dev(const InstanceHandle& instance) | 38 Zoom_Dev::Zoom_Dev(Instance* instance) : associated_instance_(instance) { |
39 : associated_instance_(instance) { | |
40 Module::Get()->AddPluginInterface(kPPPZoomInterface, &ppp_zoom); | 39 Module::Get()->AddPluginInterface(kPPPZoomInterface, &ppp_zoom); |
41 Instance::AddPerInstanceObject(instance, kPPPZoomInterface, this); | 40 instance->AddPerInstanceObject(kPPPZoomInterface, this); |
42 } | 41 } |
43 | 42 |
44 Zoom_Dev::~Zoom_Dev() { | 43 Zoom_Dev::~Zoom_Dev() { |
45 Instance::RemovePerInstanceObject(associated_instance_, | 44 Instance::RemovePerInstanceObject(associated_instance_, |
46 kPPPZoomInterface, this); | 45 kPPPZoomInterface, this); |
47 } | 46 } |
48 | 47 |
49 void Zoom_Dev::ZoomChanged(double factor) { | 48 void Zoom_Dev::ZoomChanged(double factor) { |
50 if (has_interface<PPB_Zoom_Dev>()) | 49 if (has_interface<PPB_Zoom_Dev>()) |
51 get_interface<PPB_Zoom_Dev>()->ZoomChanged( | 50 get_interface<PPB_Zoom_Dev>()->ZoomChanged( |
52 associated_instance_.pp_instance(), factor); | 51 associated_instance_.pp_instance(), factor); |
53 } | 52 } |
54 | 53 |
55 void Zoom_Dev::ZoomLimitsChanged(double minimum_factor, | 54 void Zoom_Dev::ZoomLimitsChanged(double minimum_factor, |
56 double maximium_factor) { | 55 double maximium_factor) { |
57 if (!has_interface<PPB_Zoom_Dev>()) | 56 if (!has_interface<PPB_Zoom_Dev>()) |
58 return; | 57 return; |
59 get_interface<PPB_Zoom_Dev>()->ZoomLimitsChanged( | 58 get_interface<PPB_Zoom_Dev>()->ZoomLimitsChanged( |
60 associated_instance_.pp_instance(), minimum_factor, maximium_factor); | 59 associated_instance_.pp_instance(), minimum_factor, maximium_factor); |
61 } | 60 } |
62 | 61 |
63 } // namespace pp | 62 } // namespace pp |
OLD | NEW |