OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // From dev/ppb_view_dev.idl modified Thu Mar 28 11:12:59 2013. | 5 // From dev/ppb_view_dev.idl modified Tue Aug 20 08:13:36 2013. |
6 | 6 |
7 #include "ppapi/c/dev/ppb_view_dev.h" | 7 #include "ppapi/c/dev/ppb_view_dev.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/shared_impl/tracked_callback.h" | 9 #include "ppapi/shared_impl/tracked_callback.h" |
10 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
11 #include "ppapi/thunk/ppb_instance_api.h" | 11 #include "ppapi/thunk/ppapi_thunk_export.h" |
12 #include "ppapi/thunk/ppb_view_api.h" | 12 #include "ppapi/thunk/ppb_view_api.h" |
13 #include "ppapi/thunk/resource_creation_api.h" | |
14 #include "ppapi/thunk/thunk.h" | |
15 | 13 |
16 namespace ppapi { | 14 namespace ppapi { |
17 namespace thunk { | 15 namespace thunk { |
18 | 16 |
19 namespace { | 17 namespace { |
20 | 18 |
21 float GetDeviceScale(PP_Resource resource) { | 19 float GetDeviceScale(PP_Resource resource) { |
22 VLOG(4) << "PPB_View_Dev::GetDeviceScale()"; | 20 VLOG(4) << "PPB_View_Dev::GetDeviceScale()"; |
23 EnterResource<PPB_View_API> enter(resource, true); | 21 EnterResource<PPB_View_API> enter(resource, true); |
24 if (enter.failed()) | 22 if (enter.failed()) |
25 return 0.0f; | 23 return 0.0f; |
26 return enter.object()->GetDeviceScale(); | 24 return enter.object()->GetDeviceScale(); |
27 } | 25 } |
28 | 26 |
29 float GetCSSScale(PP_Resource resource) { | 27 float GetCSSScale(PP_Resource resource) { |
30 VLOG(4) << "PPB_View_Dev::GetCSSScale()"; | 28 VLOG(4) << "PPB_View_Dev::GetCSSScale()"; |
31 EnterResource<PPB_View_API> enter(resource, true); | 29 EnterResource<PPB_View_API> enter(resource, true); |
32 if (enter.failed()) | 30 if (enter.failed()) |
33 return 0.0f; | 31 return 0.0f; |
34 return enter.object()->GetCSSScale(); | 32 return enter.object()->GetCSSScale(); |
35 } | 33 } |
36 | 34 |
37 const PPB_View_Dev_0_1 g_ppb_view_dev_thunk_0_1 = { | 35 const PPB_View_Dev_0_1 g_ppb_view_dev_thunk_0_1 = { |
38 &GetDeviceScale, | 36 &GetDeviceScale, |
39 &GetCSSScale | 37 &GetCSSScale |
40 }; | 38 }; |
41 | 39 |
42 } // namespace | 40 } // namespace |
43 | 41 |
44 const PPB_View_Dev_0_1* GetPPB_View_Dev_0_1_Thunk() { | 42 PPAPI_THUNK_EXPORT const PPB_View_Dev_0_1* GetPPB_View_Dev_0_1_Thunk() { |
45 return &g_ppb_view_dev_thunk_0_1; | 43 return &g_ppb_view_dev_thunk_0_1; |
46 } | 44 } |
47 | 45 |
48 } // namespace thunk | 46 } // namespace thunk |
49 } // namespace ppapi | 47 } // namespace ppapi |
OLD | NEW |