OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/chromeos/bluetooth/bluetooth_service_record.h" | 5 #include "device/bluetooth/bluetooth_service_record.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h" | 12 #include "device/bluetooth/bluetooth_utils.h" |
13 #include "third_party/libxml/chromium/libxml_utils.h" | 13 #include "third_party/libxml/chromium/libxml_utils.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 static const char* kAttributeNode = "attribute"; | 17 static const char* kAttributeNode = "attribute"; |
18 static const char* kIdAttribute = "id"; | 18 static const char* kIdAttribute = "id"; |
19 static const char* kProtocolDescriptorListId = "0x0004"; | 19 static const char* kProtocolDescriptorListId = "0x0004"; |
20 static const char* kRfcommUuid = "0x0003"; | 20 static const char* kRfcommUuid = "0x0003"; |
21 static const char* kSdpNameId = "0x0100"; | 21 static const char* kSdpNameId = "0x0100"; |
22 static const char* kSequenceNode = "sequence"; | 22 static const char* kSequenceNode = "sequence"; |
(...skipping 14 matching lines...) Expand all Loading... |
37 bool ExtractTextValue(XmlReader* reader, std::string* value_out) { | 37 bool ExtractTextValue(XmlReader* reader, std::string* value_out) { |
38 if (AdvanceToTag(reader, kTextNode)) { | 38 if (AdvanceToTag(reader, kTextNode)) { |
39 reader->NodeAttribute(kValueAttribute, value_out); | 39 reader->NodeAttribute(kValueAttribute, value_out); |
40 return true; | 40 return true; |
41 } | 41 } |
42 return false; | 42 return false; |
43 } | 43 } |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 namespace chromeos { | 47 namespace device { |
48 | 48 |
49 BluetoothServiceRecord::BluetoothServiceRecord( | 49 BluetoothServiceRecord::BluetoothServiceRecord( |
50 const std::string& address, | 50 const std::string& address, |
51 const std::string& xml_data) | 51 const std::string& xml_data) |
52 : address_(address), | 52 : address_(address), |
53 supports_rfcomm_(false) { | 53 supports_rfcomm_(false) { |
54 | 54 |
55 XmlReader reader; | 55 XmlReader reader; |
56 if (!reader.Load(xml_data)) | 56 if (!reader.Load(xml_data)) |
57 return; | 57 return; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 do { | 109 do { |
110 if (reader->NodeName() == kSequenceNode) { | 110 if (reader->NodeName() == kSequenceNode) { |
111 if (AdvanceToTag(reader, kUuidNode)) { | 111 if (AdvanceToTag(reader, kUuidNode)) { |
112 if (!reader->NodeAttribute(kValueAttribute, &uuid_)) | 112 if (!reader->NodeAttribute(kValueAttribute, &uuid_)) |
113 uuid_.clear(); | 113 uuid_.clear(); |
114 } | 114 } |
115 } | 115 } |
116 } while (AdvanceToTag(reader, kSequenceNode) && | 116 } while (AdvanceToTag(reader, kSequenceNode) && |
117 reader->Depth() != start_depth); | 117 reader->Depth() != start_depth); |
118 | 118 |
119 uuid_ = bluetooth_utils::CanonicalUuid(uuid_); | 119 uuid_ = device::bluetooth_utils::CanonicalUuid(uuid_); |
120 } | 120 } |
121 | 121 |
122 } // namespace chromeos | 122 } // namespace device |
OLD | NEW |