15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/cpp/dev/view_dev.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/dev/ppb_view_dev.h"
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/cpp/module_impl.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace pp {
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace {
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)template <> const char* interface_name<PPB_View_Dev>() {
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return PPB_VIEW_DEV_INTERFACE;
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)float ViewDev::GetDeviceScale() const {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  if (!has_interface<PPB_View_Dev>())
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return 1.0f;
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return get_interface<PPB_View_Dev>()->GetDeviceScale(pp_resource());
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)float ViewDev::GetCSSScale() const {
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  if (!has_interface<PPB_View_Dev>())
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return 1.0f;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return get_interface<PPB_View_Dev>()->GetCSSScale(pp_resource());
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace pp
33