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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 id_to_username.find(unix_user.substr(1, pos - 1)); | 255 id_to_username.find(unix_user.substr(1, pos - 1)); |
256 if (it != id_to_username.end()) | 256 if (it != id_to_username.end()) |
257 return it->second; | 257 return it->second; |
258 } | 258 } |
259 } | 259 } |
260 return std::string(); | 260 return std::string(); |
261 } | 261 } |
262 | 262 |
263 AndroidDeviceManager::BrowserInfo::Type | 263 AndroidDeviceManager::BrowserInfo::Type |
264 GetBrowserType(const std::string& socket) { | 264 GetBrowserType(const std::string& socket) { |
265 if (socket.find(kChromeDefaultSocket) == 0) | 265 if (base::StartsWith(socket, kChromeDefaultSocket, |
| 266 base::CompareCase::SENSITIVE)) { |
266 return AndroidDeviceManager::BrowserInfo::kTypeChrome; | 267 return AndroidDeviceManager::BrowserInfo::kTypeChrome; |
| 268 } |
267 | 269 |
268 if (socket.find(kWebViewSocketPrefix) == 0) | 270 if (base::StartsWith(socket, kWebViewSocketPrefix, |
| 271 base::CompareCase::SENSITIVE)) { |
269 return AndroidDeviceManager::BrowserInfo::kTypeWebView; | 272 return AndroidDeviceManager::BrowserInfo::kTypeWebView; |
| 273 } |
270 | 274 |
271 return AndroidDeviceManager::BrowserInfo::kTypeOther; | 275 return AndroidDeviceManager::BrowserInfo::kTypeOther; |
272 } | 276 } |
273 | 277 |
274 void ReceivedResponse(const AndroidDeviceManager::DeviceInfoCallback& callback, | 278 void ReceivedResponse(const AndroidDeviceManager::DeviceInfoCallback& callback, |
275 int result, | 279 int result, |
276 const std::string& response) { | 280 const std::string& response) { |
277 AndroidDeviceManager::DeviceInfo device_info; | 281 AndroidDeviceManager::DeviceInfo device_info; |
278 if (result < 0) { | 282 if (result < 0) { |
279 callback.Run(device_info); | 283 callback.Run(device_info); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 361 } |
358 | 362 |
359 // static | 363 // static |
360 void AndroidDeviceManager::QueryDeviceInfo( | 364 void AndroidDeviceManager::QueryDeviceInfo( |
361 const RunCommandCallback& command_callback, | 365 const RunCommandCallback& command_callback, |
362 const DeviceInfoCallback& callback) { | 366 const DeviceInfoCallback& callback) { |
363 command_callback.Run( | 367 command_callback.Run( |
364 kAllCommands, | 368 kAllCommands, |
365 base::Bind(&ReceivedResponse, callback)); | 369 base::Bind(&ReceivedResponse, callback)); |
366 } | 370 } |
OLD | NEW |