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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 device_info_.model = response; |
| 212 device_info_.connected = true; |
212 command_callback_.Run( | 213 command_callback_.Run( |
213 kDumpsysCommand, | 214 kDumpsysCommand, |
214 base::Bind(&AdbDeviceInfoQuery::ReceivedDumpsys, base::Unretained(this))); | 215 base::Bind(&AdbDeviceInfoQuery::ReceivedDumpsys, base::Unretained(this))); |
215 } | 216 } |
216 | 217 |
217 void AdbDeviceInfoQuery::ReceivedDumpsys(int result, | 218 void AdbDeviceInfoQuery::ReceivedDumpsys(int result, |
218 const std::string& response) { | 219 const std::string& response) { |
219 DCHECK(CalledOnValidThread()); | 220 DCHECK(CalledOnValidThread()); |
220 if (result >= 0) | 221 if (result >= 0) |
221 ParseDumpsysResponse(response); | 222 ParseDumpsysResponse(response); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 browser_info.display_name = GetDisplayName(socket, package); | 322 browser_info.display_name = GetDisplayName(socket, package); |
322 device_info_.browser_info.push_back(browser_info); | 323 device_info_.browser_info.push_back(browser_info); |
323 } | 324 } |
324 } | 325 } |
325 | 326 |
326 void AdbDeviceInfoQuery::Respond() { | 327 void AdbDeviceInfoQuery::Respond() { |
327 DCHECK(CalledOnValidThread()); | 328 DCHECK(CalledOnValidThread()); |
328 callback_.Run(device_info_); | 329 callback_.Run(device_info_); |
329 delete this; | 330 delete this; |
330 } | 331 } |
OLD | NEW |