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

Side by Side Diff: extensions/browser/api/bluetooth_low_energy/utils.cc

Issue 2370373002: Move chrome.bluetoothLowEnergy out of //chrome. (Closed)
Patch Set: build fix Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/extensions/api/bluetooth_low_energy/utils.h" 5 #include "extensions/browser/api/bluetooth_low_energy/utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <iterator> 8 #include <iterator>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 namespace api { 14 namespace api {
15 namespace bluetooth_low_energy { 15 namespace bluetooth_low_energy {
16 16
17 namespace { 17 namespace {
18 18
19 // Converts a list of CharacteristicProperty to a base::ListValue of strings. 19 // Converts a list of CharacteristicProperty to a base::ListValue of strings.
20 std::unique_ptr<base::ListValue> CharacteristicPropertiesToValue( 20 std::unique_ptr<base::ListValue> CharacteristicPropertiesToValue(
21 const std::vector<CharacteristicProperty> properties) { 21 const std::vector<CharacteristicProperty> properties) {
22 std::unique_ptr<base::ListValue> property_list(new base::ListValue()); 22 std::unique_ptr<base::ListValue> property_list(new base::ListValue());
23 for (std::vector<CharacteristicProperty>::const_iterator iter = 23 for (std::vector<CharacteristicProperty>::const_iterator iter =
24 properties.begin(); 24 properties.begin();
25 iter != properties.end(); 25 iter != properties.end(); ++iter)
26 ++iter)
27 property_list->AppendString(ToString(*iter)); 26 property_list->AppendString(ToString(*iter));
28 return property_list; 27 return property_list;
29 } 28 }
30 29
31 } // namespace 30 } // namespace
32 31
33 std::unique_ptr<base::DictionaryValue> CharacteristicToValue( 32 std::unique_ptr<base::DictionaryValue> CharacteristicToValue(
34 Characteristic* from) { 33 Characteristic* from) {
35 // Copy the properties. Use Characteristic::ToValue to generate the result 34 // Copy the properties. Use Characteristic::ToValue to generate the result
36 // dictionary without the properties, to prevent json_schema_compiler from 35 // dictionary without the properties, to prevent json_schema_compiler from
(...skipping 20 matching lines...) Expand all
57 to->GetDictionaryWithoutPathExpansion("characteristic", &chrc_value); 56 to->GetDictionaryWithoutPathExpansion("characteristic", &chrc_value);
58 DCHECK(chrc_value); 57 DCHECK(chrc_value);
59 chrc_value->SetWithoutPathExpansion( 58 chrc_value->SetWithoutPathExpansion(
60 "properties", CharacteristicPropertiesToValue(properties).release()); 59 "properties", CharacteristicPropertiesToValue(properties).release());
61 return to; 60 return to;
62 } 61 }
63 62
64 } // namespace bluetooth_low_energy 63 } // namespace bluetooth_low_energy
65 } // namespace api 64 } // namespace api
66 } // namespace extensions 65 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698