Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/browser/devtools/device/devtools_device_discovery.cc

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/devtools_device_discovery.h" 5 #include "chrome/browser/devtools/device/devtools_device_discovery.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 scoped_refptr<RemoteBrowser> browser, 476 scoped_refptr<RemoteBrowser> browser,
477 int result, 477 int result,
478 const std::string& response) { 478 const std::string& response) {
479 DCHECK_CURRENTLY_ON(BrowserThread::UI); 479 DCHECK_CURRENTLY_ON(BrowserThread::UI);
480 if (result < 0) 480 if (result < 0)
481 return; 481 return;
482 std::unique_ptr<base::Value> value = base::JSONReader::Read(response); 482 std::unique_ptr<base::Value> value = base::JSONReader::Read(response);
483 base::ListValue* list_value; 483 base::ListValue* list_value;
484 if (value && value->GetAsList(&list_value)) { 484 if (value && value->GetAsList(&list_value)) {
485 for (const auto& page_value : *list_value) { 485 for (const auto& page_value : *list_value) {
486 const base::DictionaryValue* dict; 486 base::DictionaryValue* dict;
487 if (page_value.GetAsDictionary(&dict)) 487 if (page_value->GetAsDictionary(&dict))
488 browser->pages_.push_back( 488 browser->pages_.push_back(
489 new RemotePage(device, browser->browser_id_, *dict)); 489 new RemotePage(device, browser->browser_id_, *dict));
490 } 490 }
491 } 491 }
492 } 492 }
493 493
494 // DevToolsDeviceDiscovery::RemotePage ---------------------------------------- 494 // DevToolsDeviceDiscovery::RemotePage ----------------------------------------
495 495
496 DevToolsDeviceDiscovery::RemotePage::RemotePage( 496 DevToolsDeviceDiscovery::RemotePage::RemotePage(
497 scoped_refptr<AndroidDeviceManager::Device> device, 497 scoped_refptr<AndroidDeviceManager::Device> device,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 617 }
618 618
619 void DevToolsDeviceDiscovery::ReceivedDeviceList( 619 void DevToolsDeviceDiscovery::ReceivedDeviceList(
620 const CompleteDevices& complete_devices) { 620 const CompleteDevices& complete_devices) {
621 DCHECK_CURRENTLY_ON(BrowserThread::UI); 621 DCHECK_CURRENTLY_ON(BrowserThread::UI);
622 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList, 622 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList,
623 weak_factory_.GetWeakPtr())); 623 weak_factory_.GetWeakPtr()));
624 // |callback_| should be run last as it may destroy |this|. 624 // |callback_| should be run last as it may destroy |this|.
625 callback_.Run(complete_devices); 625 callback_.Run(complete_devices);
626 } 626 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698