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

Side by Side Diff: chrome/browser/extensions/api/commands/commands.cc

Issue 2323993004: Remove use of deprecated base::ListValue::Append(Value*) overload in extensions. (Closed)
Patch Set: Less explosions 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 #include "chrome/browser/extensions/api/commands/commands.h" 5 #include "chrome/browser/extensions/api/commands/commands.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "chrome/browser/extensions/api/commands/command_service.h" 10 #include "chrome/browser/extensions/api/commands/command_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 12
13 namespace { 13 namespace {
14 14
15 base::DictionaryValue* CreateCommandValue( 15 std::unique_ptr<base::DictionaryValue> CreateCommandValue(
16 const extensions::Command& command, bool active) { 16 const extensions::Command& command,
17 base::DictionaryValue* result = new base::DictionaryValue(); 17 bool active) {
18 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
Devlin 2016/09/12 19:12:34 I'm assuming that future MakeUnique calls are orth
dcheng 2016/09/12 20:26:45 This CL has been in progress for awhile: previousl
18 result->SetString("name", command.command_name()); 19 result->SetString("name", command.command_name());
19 result->SetString("description", command.description()); 20 result->SetString("description", command.description());
20 result->SetString("shortcut", 21 result->SetString("shortcut",
21 active ? command.accelerator().GetShortcutText() : 22 active ? command.accelerator().GetShortcutText() :
22 base::string16()); 23 base::string16());
23 return result; 24 return result;
24 } 25 }
25 26
26 } // namespace 27 } // namespace
27 28
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 extensions::Command command = command_service->FindCommandByName( 60 extensions::Command command = command_service->FindCommandByName(
60 extension_->id(), iter->second.command_name()); 61 extension_->id(), iter->second.command_name());
61 ui::Accelerator shortcut_assigned = command.accelerator(); 62 ui::Accelerator shortcut_assigned = command.accelerator();
62 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); 63 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN);
63 64
64 command_list->Append(CreateCommandValue(iter->second, active)); 65 command_list->Append(CreateCommandValue(iter->second, active));
65 } 66 }
66 67
67 return RespondNow(OneArgument(std::move(command_list))); 68 return RespondNow(OneArgument(std::move(command_list)));
68 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698