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/adb/adb_device_info_query.h" | 5 #include "chrome/browser/devtools/device/adb/adb_device_info_query.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 | 10 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 AdbDeviceInfoQuery::~AdbDeviceInfoQuery() { | 201 AdbDeviceInfoQuery::~AdbDeviceInfoQuery() { |
202 } | 202 } |
203 | 203 |
204 void AdbDeviceInfoQuery::ReceivedModel(int result, | 204 void AdbDeviceInfoQuery::ReceivedModel(int result, |
205 const std::string& response) { | 205 const std::string& response) { |
206 DCHECK(CalledOnValidThread()); | 206 DCHECK(CalledOnValidThread()); |
207 if (result < 0) { | 207 if (result < 0) { |
208 Respond(); | 208 Respond(); |
209 return; | 209 return; |
210 } | 210 } |
211 device_info_.model = response; | 211 TrimWhitespaceASCII(response, base::TRIM_ALL, &device_info_.model); |
212 device_info_.connected = true; | 212 device_info_.connected = true; |
213 command_callback_.Run( | 213 command_callback_.Run( |
214 kDumpsysCommand, | 214 kDumpsysCommand, |
215 base::Bind(&AdbDeviceInfoQuery::ReceivedDumpsys, base::Unretained(this))); | 215 base::Bind(&AdbDeviceInfoQuery::ReceivedDumpsys, base::Unretained(this))); |
216 } | 216 } |
217 | 217 |
218 void AdbDeviceInfoQuery::ReceivedDumpsys(int result, | 218 void AdbDeviceInfoQuery::ReceivedDumpsys(int result, |
219 const std::string& response) { | 219 const std::string& response) { |
220 DCHECK(CalledOnValidThread()); | 220 DCHECK(CalledOnValidThread()); |
221 if (result >= 0) | 221 if (result >= 0) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 browser_info.display_name = GetDisplayName(socket, package); | 322 browser_info.display_name = GetDisplayName(socket, package); |
323 device_info_.browser_info.push_back(browser_info); | 323 device_info_.browser_info.push_back(browser_info); |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 void AdbDeviceInfoQuery::Respond() { | 327 void AdbDeviceInfoQuery::Respond() { |
328 DCHECK(CalledOnValidThread()); | 328 DCHECK(CalledOnValidThread()); |
329 callback_.Run(device_info_); | 329 callback_.Run(device_info_); |
330 delete this; | 330 delete this; |
331 } | 331 } |
OLD | NEW |