[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ppapi / shared_impl / socket_option_data.cc
blob27e66a2b4b5d0816b75ce062799b3e4d2083ae90
1 // Copyright 2013 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/shared_impl/socket_option_data.h"
7 namespace ppapi {
9 SocketOptionData::SocketOptionData() : type_(TYPE_INVALID), value_(0) {}
11 SocketOptionData::~SocketOptionData() {}
13 SocketOptionData::Type SocketOptionData::GetType() const { return type_; }
15 bool SocketOptionData::GetBool(bool* out_value) const {
16 if (!out_value || type_ != TYPE_BOOL)
17 return false;
18 *out_value = value_ != 0;
19 return true;
22 bool SocketOptionData::GetInt32(int32_t* out_value) const {
23 if (!out_value || type_ != TYPE_INT32)
24 return false;
25 *out_value = value_;
26 return true;
29 void SocketOptionData::SetBool(bool value) {
30 type_ = TYPE_BOOL;
31 value_ = value ? 1 : 0;
34 void SocketOptionData::SetInt32(int32_t value) {
35 type_ = TYPE_INT32;
36 value_ = value;
39 } // namespace ppapi