Make certificate viewer a tab-modal dialog.
[chromium-blink-merge.git] / ppapi / thunk / ppb_view_thunk.cc
blob3014099dda8280df0a497d71ff612964823439d4
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
3 // found in the LICENSE file.
5 // From ppb_view.idl modified Wed Apr 10 14:15:15 2013.
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_view.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppb_instance_api.h"
12 #include "ppapi/thunk/ppb_view_api.h"
13 #include "ppapi/thunk/resource_creation_api.h"
14 #include "ppapi/thunk/thunk.h"
16 namespace ppapi {
17 namespace thunk {
19 namespace {
21 PP_Bool IsView(PP_Resource resource) {
22 VLOG(4) << "PPB_View::IsView()";
23 EnterResource<PPB_View_API> enter(resource, false);
24 return PP_FromBool(enter.succeeded());
27 PP_Bool GetRect(PP_Resource resource, struct PP_Rect* rect) {
28 VLOG(4) << "PPB_View::GetRect()";
29 EnterResource<PPB_View_API> enter(resource, true);
30 if (enter.failed())
31 return PP_FALSE;
32 return enter.object()->GetRect(rect);
35 PP_Bool IsFullscreen(PP_Resource resource) {
36 VLOG(4) << "PPB_View::IsFullscreen()";
37 EnterResource<PPB_View_API> enter(resource, true);
38 if (enter.failed())
39 return PP_FALSE;
40 return enter.object()->IsFullscreen();
43 PP_Bool IsVisible(PP_Resource resource) {
44 VLOG(4) << "PPB_View::IsVisible()";
45 EnterResource<PPB_View_API> enter(resource, true);
46 if (enter.failed())
47 return PP_FALSE;
48 return enter.object()->IsVisible();
51 PP_Bool IsPageVisible(PP_Resource resource) {
52 VLOG(4) << "PPB_View::IsPageVisible()";
53 EnterResource<PPB_View_API> enter(resource, true);
54 if (enter.failed())
55 return PP_FALSE;
56 return enter.object()->IsPageVisible();
59 PP_Bool GetClipRect(PP_Resource resource, struct PP_Rect* clip) {
60 VLOG(4) << "PPB_View::GetClipRect()";
61 EnterResource<PPB_View_API> enter(resource, true);
62 if (enter.failed())
63 return PP_FALSE;
64 return enter.object()->GetClipRect(clip);
67 float GetDeviceScale(PP_Resource resource) {
68 VLOG(4) << "PPB_View::GetDeviceScale()";
69 EnterResource<PPB_View_API> enter(resource, true);
70 if (enter.failed())
71 return 0.0f;
72 return enter.object()->GetDeviceScale();
75 float GetCSSScale(PP_Resource resource) {
76 VLOG(4) << "PPB_View::GetCSSScale()";
77 EnterResource<PPB_View_API> enter(resource, true);
78 if (enter.failed())
79 return 0.0f;
80 return enter.object()->GetCSSScale();
83 const PPB_View_1_0 g_ppb_view_thunk_1_0 = {
84 &IsView,
85 &GetRect,
86 &IsFullscreen,
87 &IsVisible,
88 &IsPageVisible,
89 &GetClipRect
92 const PPB_View_1_1 g_ppb_view_thunk_1_1 = {
93 &IsView,
94 &GetRect,
95 &IsFullscreen,
96 &IsVisible,
97 &IsPageVisible,
98 &GetClipRect,
99 &GetDeviceScale,
100 &GetCSSScale
103 } // namespace
105 const PPB_View_1_0* GetPPB_View_1_0_Thunk() {
106 return &g_ppb_view_thunk_1_0;
109 const PPB_View_1_1* GetPPB_View_1_1_Thunk() {
110 return &g_ppb_view_thunk_1_1;
113 } // namespace thunk
114 } // namespace ppapi