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/device/android_device_manager.h" | 5 #include "chrome/browser/devtools/device/android_device_manager.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 size_t start_pos = response_.find(header); | 216 size_t start_pos = response_.find(header); |
217 if (start_pos == std::string::npos) | 217 if (start_pos == std::string::npos) |
218 return std::string(); | 218 return std::string(); |
219 | 219 |
220 size_t endline_pos = response_.find("\n", start_pos); | 220 size_t endline_pos = response_.find("\n", start_pos); |
221 if (endline_pos == std::string::npos) | 221 if (endline_pos == std::string::npos) |
222 return std::string(); | 222 return std::string(); |
223 | 223 |
224 std::string value = response_.substr( | 224 std::string value = response_.substr( |
225 start_pos + header.length(), endline_pos - start_pos - header.length()); | 225 start_pos + header.length(), endline_pos - start_pos - header.length()); |
226 base::TrimWhitespace(value, base::TRIM_ALL, &value); | 226 base::TrimWhitespaceASCII(value, base::TRIM_ALL, &value); |
227 return value; | 227 return value; |
228 } | 228 } |
229 | 229 |
230 bool CheckNetResultOrDie(int result) { | 230 bool CheckNetResultOrDie(int result) { |
231 if (result >= 0) | 231 if (result >= 0) |
232 return true; | 232 return true; |
233 if (!command_callback_.is_null()) { | 233 if (!command_callback_.is_null()) { |
234 command_callback_.Run(result, std::string()); | 234 command_callback_.Run(result, std::string()); |
235 } else { | 235 } else { |
236 http_upgrade_callback_.Run( | 236 http_upgrade_callback_.Run( |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 new Device(handler_thread_->message_loop(), it->provider, it->serial); | 539 new Device(handler_thread_->message_loop(), it->provider, it->serial); |
540 } else { | 540 } else { |
541 device = found->second.get(); | 541 device = found->second.get(); |
542 } | 542 } |
543 response.push_back(device); | 543 response.push_back(device); |
544 new_devices[it->serial] = device->weak_factory_.GetWeakPtr(); | 544 new_devices[it->serial] = device->weak_factory_.GetWeakPtr(); |
545 } | 545 } |
546 devices_.swap(new_devices); | 546 devices_.swap(new_devices); |
547 callback.Run(response); | 547 callback.Run(response); |
548 } | 548 } |
OLD | NEW |