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

Side by Side Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 2323993004: Remove use of deprecated base::ListValue::Append(Value*) overload in extensions. (Closed)
Patch Set: ... I hate C++ Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Implements the Chrome Extensions Debugger API. 5 // Implements the Chrome Extensions Debugger API.
6 6
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 const char kTargetIdField[] = "id"; 670 const char kTargetIdField[] = "id";
671 const char kTargetTypeField[] = "type"; 671 const char kTargetTypeField[] = "type";
672 const char kTargetTitleField[] = "title"; 672 const char kTargetTitleField[] = "title";
673 const char kTargetAttachedField[] = "attached"; 673 const char kTargetAttachedField[] = "attached";
674 const char kTargetUrlField[] = "url"; 674 const char kTargetUrlField[] = "url";
675 const char kTargetFaviconUrlField[] = "faviconUrl"; 675 const char kTargetFaviconUrlField[] = "faviconUrl";
676 const char kTargetTabIdField[] = "tabId"; 676 const char kTargetTabIdField[] = "tabId";
677 const char kTargetExtensionIdField[] = "extensionId"; 677 const char kTargetExtensionIdField[] = "extensionId";
678 const char kTargetTypeWorker[] = "worker"; 678 const char kTargetTypeWorker[] = "worker";
679 679
680 base::Value* SerializeTarget(scoped_refptr<DevToolsAgentHost> host) { 680 std::unique_ptr<base::DictionaryValue> SerializeTarget(
681 base::DictionaryValue* dictionary = new base::DictionaryValue(); 681 scoped_refptr<DevToolsAgentHost> host) {
682 std::unique_ptr<base::DictionaryValue> dictionary(
683 new base::DictionaryValue());
682 dictionary->SetString(kTargetIdField, host->GetId()); 684 dictionary->SetString(kTargetIdField, host->GetId());
683 dictionary->SetString(kTargetTitleField, host->GetTitle()); 685 dictionary->SetString(kTargetTitleField, host->GetTitle());
684 dictionary->SetBoolean(kTargetAttachedField, host->IsAttached()); 686 dictionary->SetBoolean(kTargetAttachedField, host->IsAttached());
685 dictionary->SetString(kTargetUrlField, host->GetURL().spec()); 687 dictionary->SetString(kTargetUrlField, host->GetURL().spec());
686 688
687 std::string type = host->GetType(); 689 std::string type = host->GetType();
688 if (type == DevToolsAgentHost::kTypePage) { 690 if (type == DevToolsAgentHost::kTypePage) {
689 int tab_id = 691 int tab_id =
690 extensions::ExtensionTabUtil::GetTabId(host->GetWebContents()); 692 extensions::ExtensionTabUtil::GetTabId(host->GetWebContents());
691 dictionary->SetInteger(kTargetTabIdField, tab_id); 693 dictionary->SetInteger(kTargetTabIdField, tab_id);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 void DebuggerGetTargetsFunction::SendTargetList( 729 void DebuggerGetTargetsFunction::SendTargetList(
728 const content::DevToolsAgentHost::List& target_list) { 730 const content::DevToolsAgentHost::List& target_list) {
729 std::unique_ptr<base::ListValue> result(new base::ListValue()); 731 std::unique_ptr<base::ListValue> result(new base::ListValue());
730 for (size_t i = 0; i < target_list.size(); ++i) 732 for (size_t i = 0; i < target_list.size(); ++i)
731 result->Append(SerializeTarget(target_list[i])); 733 result->Append(SerializeTarget(target_list[i]));
732 SetResult(std::move(result)); 734 SetResult(std::move(result));
733 SendResponse(true); 735 SendResponse(true);
734 } 736 }
735 737
736 } // namespace extensions 738 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698