Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: device/bluetooth/dbus/bluetooth_device_client.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/dbus/bluetooth_device_client.h" 5 #include "device/bluetooth/dbus/bluetooth_device_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Fall through. 47 // Fall through.
48 case bluez::BluetoothServiceAttributeValueBlueZ::INT: { 48 case bluez::BluetoothServiceAttributeValueBlueZ::INT: {
49 switch (size) { 49 switch (size) {
50 // It doesn't matter what 'sign' the number is, only size. 50 // It doesn't matter what 'sign' the number is, only size.
51 // Whenever we unpack this value, we will take the raw bits and 51 // Whenever we unpack this value, we will take the raw bits and
52 // cast it back to the correct sign anyway. 52 // cast it back to the correct sign anyway.
53 case 1: 53 case 1:
54 uint8_t byte; 54 uint8_t byte;
55 if (!struct_reader->PopVariantOfByte(&byte)) 55 if (!struct_reader->PopVariantOfByte(&byte))
56 return nullptr; 56 return nullptr;
57 value = base::MakeUnique<base::FundamentalValue>(byte); 57 value = base::MakeUnique<base::Value>(byte);
58 break; 58 break;
59 case 2: 59 case 2:
60 uint16_t short_val; 60 uint16_t short_val;
61 if (!struct_reader->PopVariantOfUint16(&short_val)) 61 if (!struct_reader->PopVariantOfUint16(&short_val))
62 return nullptr; 62 return nullptr;
63 value = base::MakeUnique<base::FundamentalValue>(short_val); 63 value = base::MakeUnique<base::Value>(short_val);
64 break; 64 break;
65 case 4: 65 case 4:
66 uint32_t val; 66 uint32_t val;
67 if (!struct_reader->PopVariantOfUint32(&val)) 67 if (!struct_reader->PopVariantOfUint32(&val))
68 return nullptr; 68 return nullptr;
69 value = base::MakeUnique<base::FundamentalValue>( 69 value = base::MakeUnique<base::Value>(static_cast<int32_t>(val));
70 static_cast<int32_t>(val));
71 break; 70 break;
72 case 8: 71 case 8:
73 // Fall through. 72 // Fall through.
74 // BlueZ should never be sending us this size at the moment since 73 // BlueZ should never be sending us this size at the moment since
75 // the Android SDP records we will create from these raw records 74 // the Android SDP records we will create from these raw records
76 // don't have any fields which use this size. If we ever decide to 75 // don't have any fields which use this size. If we ever decide to
77 // change this, this needs to get fixed. 76 // change this, this needs to get fixed.
78 default: 77 default:
79 NOTREACHED(); 78 NOTREACHED();
80 } 79 }
81 break; 80 break;
82 } 81 }
83 case bluez::BluetoothServiceAttributeValueBlueZ::UUID: 82 case bluez::BluetoothServiceAttributeValueBlueZ::UUID:
84 // Fall through. 83 // Fall through.
85 case bluez::BluetoothServiceAttributeValueBlueZ::STRING: 84 case bluez::BluetoothServiceAttributeValueBlueZ::STRING:
86 // Fall through. 85 // Fall through.
87 case bluez::BluetoothServiceAttributeValueBlueZ::URL: { 86 case bluez::BluetoothServiceAttributeValueBlueZ::URL: {
88 std::string str; 87 std::string str;
89 if (!struct_reader->PopVariantOfString(&str)) 88 if (!struct_reader->PopVariantOfString(&str))
90 return nullptr; 89 return nullptr;
91 value = base::MakeUnique<base::StringValue>(str); 90 value = base::MakeUnique<base::StringValue>(str);
92 break; 91 break;
93 } 92 }
94 case bluez::BluetoothServiceAttributeValueBlueZ::BOOL: { 93 case bluez::BluetoothServiceAttributeValueBlueZ::BOOL: {
95 bool b; 94 bool b;
96 if (!struct_reader->PopVariantOfBool(&b)) 95 if (!struct_reader->PopVariantOfBool(&b))
97 return nullptr; 96 return nullptr;
98 value = base::MakeUnique<base::FundamentalValue>(b); 97 value = base::MakeUnique<base::Value>(b);
99 break; 98 break;
100 } 99 }
101 case bluez::BluetoothServiceAttributeValueBlueZ::SEQUENCE: { 100 case bluez::BluetoothServiceAttributeValueBlueZ::SEQUENCE: {
102 dbus::MessageReader variant_reader(nullptr); 101 dbus::MessageReader variant_reader(nullptr);
103 if (!struct_reader->PopVariant(&variant_reader)) 102 if (!struct_reader->PopVariant(&variant_reader))
104 return nullptr; 103 return nullptr;
105 dbus::MessageReader array_reader(nullptr); 104 dbus::MessageReader array_reader(nullptr);
106 if (!variant_reader.PopArray(&array_reader)) 105 if (!variant_reader.PopArray(&array_reader))
107 return nullptr; 106 return nullptr;
108 std::unique_ptr<BluetoothServiceAttributeValueBlueZ::Sequence> sequence = 107 std::unique_ptr<BluetoothServiceAttributeValueBlueZ::Sequence> sequence =
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 566
568 BluetoothDeviceClient::BluetoothDeviceClient() {} 567 BluetoothDeviceClient::BluetoothDeviceClient() {}
569 568
570 BluetoothDeviceClient::~BluetoothDeviceClient() {} 569 BluetoothDeviceClient::~BluetoothDeviceClient() {}
571 570
572 BluetoothDeviceClient* BluetoothDeviceClient::Create() { 571 BluetoothDeviceClient* BluetoothDeviceClient::Create() {
573 return new BluetoothDeviceClientImpl(); 572 return new BluetoothDeviceClientImpl();
574 } 573 }
575 574
576 } // namespace bluez 575 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698