| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/devtools/device/cast_device_provider.h" | 5 #include "chrome/browser/devtools/device/cast_device_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 if (index < 0 && key_value_str != "") { | 36 if (index < 0 && key_value_str != "") { |
| 37 // Some strings may only define a key (no '=' in the key/value string). | 37 // Some strings may only define a key (no '=' in the key/value string). |
| 38 // The chosen behavior is to assume the value is the empty string. | 38 // The chosen behavior is to assume the value is the empty string. |
| 39 record_map->insert(std::make_pair(key_value_str, "")); | 39 record_map->insert(std::make_pair(key_value_str, "")); |
| 40 } else { | 40 } else { |
| 41 std::string key = key_value_str.substr(0, index); | 41 std::string key = key_value_str.substr(0, index); |
| 42 std::string value = key_value_str.substr(index + 1); | 42 std::string value = key_value_str.substr(index + 1); |
| 43 record_map->insert(std::make_pair(key, value)); | 43 record_map->insert(std::make_pair(key, value)); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 return record_map.Pass(); | 46 return record_map; |
| 47 } | 47 } |
| 48 | 48 |
| 49 AndroidDeviceManager::DeviceInfo ServiceDescriptionToDeviceInfo( | 49 AndroidDeviceManager::DeviceInfo ServiceDescriptionToDeviceInfo( |
| 50 const ServiceDescription& service_description) { | 50 const ServiceDescription& service_description) { |
| 51 scoped_ptr<ServiceTxtRecordMap> record_map = | 51 scoped_ptr<ServiceTxtRecordMap> record_map = |
| 52 ParseServiceTxtRecord(service_description.metadata); | 52 ParseServiceTxtRecord(service_description.metadata); |
| 53 | 53 |
| 54 AndroidDeviceManager::DeviceInfo device_info; | 54 AndroidDeviceManager::DeviceInfo device_info; |
| 55 device_info.connected = true; | 55 device_info.connected = true; |
| 56 const auto& search = record_map->find("md"); | 56 const auto& search = record_map->find("md"); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (it_device == device_info_map_.end()) | 194 if (it_device == device_info_map_.end()) |
| 195 return; | 195 return; |
| 196 device_info_map_.erase(it_device); | 196 device_info_map_.erase(it_device); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void CastDeviceProvider::OnDeviceCacheFlushed() { | 199 void CastDeviceProvider::OnDeviceCacheFlushed() { |
| 200 VLOG(1) << "Device cache flushed"; | 200 VLOG(1) << "Device cache flushed"; |
| 201 service_hostname_map_.clear(); | 201 service_hostname_map_.clear(); |
| 202 device_info_map_.clear(); | 202 device_info_map_.clear(); |
| 203 } | 203 } |
| OLD | NEW |