| OLD | NEW |
| 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/devtools/chrome_devtools_manager_delegate.h" | 5 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/devtools/device/android_device_manager.h" | 10 #include "chrome/browser/devtools/device/android_device_manager.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // Could have been created late. | 255 // Could have been created late. |
| 256 if (host_data_.find(agent_host) == host_data_.end()) | 256 if (host_data_.find(agent_host) == host_data_.end()) |
| 257 DevToolsAgentHostAttached(agent_host); | 257 DevToolsAgentHostAttached(agent_host); |
| 258 | 258 |
| 259 std::set<net::HostPortPair> tcp_locations; | 259 std::set<net::HostPortPair> tcp_locations; |
| 260 base::ListValue* locations; | 260 base::ListValue* locations; |
| 261 if (!params->GetList(kLocationsParam, &locations)) | 261 if (!params->GetList(kLocationsParam, &locations)) |
| 262 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, | 262 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, |
| 263 kLocationsParam); | 263 kLocationsParam); |
| 264 for (const auto& item : *locations) { | 264 for (const auto& item : *locations) { |
| 265 if (!item.IsType(base::Value::Type::DICTIONARY)) { | 265 if (!item->IsType(base::Value::Type::DICTIONARY)) { |
| 266 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, | 266 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, |
| 267 kLocationsParam); | 267 kLocationsParam); |
| 268 } | 268 } |
| 269 const base::DictionaryValue* dictionary = | 269 base::DictionaryValue* dictionary = |
| 270 static_cast<const base::DictionaryValue*>(&item); | 270 static_cast<base::DictionaryValue*>(item.get()); |
| 271 std::string host; | 271 std::string host; |
| 272 if (!dictionary->GetStringWithoutPathExpansion(kHostParam, &host)) { | 272 if (!dictionary->GetStringWithoutPathExpansion(kHostParam, &host)) { |
| 273 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, | 273 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, |
| 274 kLocationsParam); | 274 kLocationsParam); |
| 275 } | 275 } |
| 276 int port = 0; | 276 int port = 0; |
| 277 if (!dictionary->GetIntegerWithoutPathExpansion(kPortParam, &port)) { | 277 if (!dictionary->GetIntegerWithoutPathExpansion(kPortParam, &port)) { |
| 278 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, | 278 return DevToolsProtocol::CreateInvalidParamsResponse(command_id, |
| 279 kLocationsParam); | 279 kLocationsParam); |
| 280 } | 280 } |
| 281 tcp_locations.insert(net::HostPortPair(host, port)); | 281 tcp_locations.insert(net::HostPortPair(host, port)); |
| 282 } | 282 } |
| 283 | 283 |
| 284 host_data_[agent_host]->set_remote_locations(tcp_locations); | 284 host_data_[agent_host]->set_remote_locations(tcp_locations); |
| 285 UpdateDeviceDiscovery(); | 285 UpdateDeviceDiscovery(); |
| 286 | 286 |
| 287 std::unique_ptr<base::DictionaryValue> result( | 287 std::unique_ptr<base::DictionaryValue> result( |
| 288 base::MakeUnique<base::DictionaryValue>()); | 288 base::MakeUnique<base::DictionaryValue>()); |
| 289 return DevToolsProtocol::CreateSuccessResponse(command_id, std::move(result)); | 289 return DevToolsProtocol::CreateSuccessResponse(command_id, std::move(result)); |
| 290 } | 290 } |
| OLD | NEW |