[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ppapi / cpp / private / flash_message_loop.cc
blob7f2543821778ba99dbde771f0d3255ffa3f186de
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 #include "ppapi/cpp/private/flash_message_loop.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_flash_message_loop.h"
9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/module_impl.h"
12 namespace pp {
14 namespace {
16 template <> const char* interface_name<PPB_Flash_MessageLoop>() {
17 return PPB_FLASH_MESSAGELOOP_INTERFACE;
20 } // namespace
22 namespace flash {
24 MessageLoop::MessageLoop(const InstanceHandle& instance) {
25 if (has_interface<PPB_Flash_MessageLoop>()) {
26 PassRefFromConstructor(get_interface<PPB_Flash_MessageLoop>()->Create(
27 instance.pp_instance()));
31 MessageLoop::~MessageLoop() {
34 // static
35 bool MessageLoop::IsAvailable() {
36 return has_interface<PPB_Flash_MessageLoop>();
39 int32_t MessageLoop::Run() {
40 if (!has_interface<PPB_Flash_MessageLoop>())
41 return PP_ERROR_NOINTERFACE;
42 return get_interface<PPB_Flash_MessageLoop>()->Run(pp_resource());
45 void MessageLoop::Quit() {
46 if (has_interface<PPB_Flash_MessageLoop>())
47 get_interface<PPB_Flash_MessageLoop>()->Quit(pp_resource());
50 } // namespace flash
51 } // namespace pp