OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #include "ppapi/cpp/view.h" |
| 6 |
| 7 #include "ppapi/c/ppb_view.h" |
| 8 #include "ppapi/cpp/module_impl.h" |
| 9 |
| 10 namespace pp { |
| 11 |
| 12 namespace { |
| 13 |
| 14 template <> const char* interface_name<PPB_View>() { |
| 15 return PPB_VIEW_INTERFACE; |
| 16 } |
| 17 |
| 18 } // namespace |
| 19 |
| 20 View::View() : Resource() { |
| 21 } |
| 22 |
| 23 View::View(PP_Resource view_resource) : Resource(view_resource) { |
| 24 } |
| 25 |
| 26 Rect View::GetRect() const { |
| 27 if (!has_interface<PPB_View>()) |
| 28 return Rect(); |
| 29 PP_Rect out; |
| 30 if (PP_ToBool(get_interface<PPB_View>()->GetRect(pp_resource(), &out))) |
| 31 return Rect(out); |
| 32 return Rect(); |
| 33 } |
| 34 |
| 35 bool View::IsFullscreen() const { |
| 36 if (!has_interface<PPB_View>()) |
| 37 return false; |
| 38 return PP_ToBool(get_interface<PPB_View>()->IsFullscreen(pp_resource())); |
| 39 } |
| 40 |
| 41 bool View::IsVisible() const { |
| 42 if (!has_interface<PPB_View>()) |
| 43 return false; |
| 44 return PP_ToBool(get_interface<PPB_View>()->IsVisible(pp_resource())); |
| 45 } |
| 46 |
| 47 bool View::IsPageVisible() const { |
| 48 if (!has_interface<PPB_View>()) |
| 49 return true; |
| 50 return PP_ToBool(get_interface<PPB_View>()->IsPageVisible(pp_resource())); |
| 51 } |
| 52 |
| 53 Rect View::GetClipRect() const { |
| 54 if (!has_interface<PPB_View>()) |
| 55 return Rect(); |
| 56 PP_Rect out; |
| 57 if (PP_ToBool(get_interface<PPB_View>()->GetClipRect(pp_resource(), &out))) |
| 58 return Rect(out); |
| 59 return Rect(); |
| 60 } |
| 61 |
| 62 } // namespace pp |
OLD | NEW |