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

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

Issue 252653002: Rename (Chrome)SyncExtensionFunction::RunImpl to RunSync so that the RunImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 "chrome/browser/extensions/api/commands/command_service.h" 7 #include "chrome/browser/extensions/api/commands/command_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 9
10 namespace { 10 namespace {
11 11
12 base::DictionaryValue* CreateCommandValue( 12 base::DictionaryValue* CreateCommandValue(
13 const extensions::Command& command, bool active) { 13 const extensions::Command& command, bool active) {
14 base::DictionaryValue* result = new base::DictionaryValue(); 14 base::DictionaryValue* result = new base::DictionaryValue();
15 result->SetString("name", command.command_name()); 15 result->SetString("name", command.command_name());
16 result->SetString("description", command.description()); 16 result->SetString("description", command.description());
17 result->SetString("shortcut", 17 result->SetString("shortcut",
18 active ? command.accelerator().GetShortcutText() : 18 active ? command.accelerator().GetShortcutText() :
19 base::string16()); 19 base::string16());
20 return result; 20 return result;
21 } 21 }
22 22
23 } // namespace 23 } // namespace
24 24
25 bool GetAllCommandsFunction::RunImpl() { 25 bool GetAllCommandsFunction::RunSync() {
26 base::ListValue* command_list = new base::ListValue(); 26 base::ListValue* command_list = new base::ListValue();
27 27
28 extensions::CommandService* command_service = 28 extensions::CommandService* command_service =
29 extensions::CommandService::Get(GetProfile()); 29 extensions::CommandService::Get(GetProfile());
30 30
31 extensions::Command browser_action; 31 extensions::Command browser_action;
32 bool active = false; 32 bool active = false;
33 if (command_service->GetBrowserActionCommand(extension_->id(), 33 if (command_service->GetBrowserActionCommand(extension_->id(),
34 extensions::CommandService::ALL, 34 extensions::CommandService::ALL,
35 &browser_action, 35 &browser_action,
(...skipping 21 matching lines...) Expand all
57 extension_->id(), iter->second.command_name()); 57 extension_->id(), iter->second.command_name());
58 ui::Accelerator shortcut_assigned = command.accelerator(); 58 ui::Accelerator shortcut_assigned = command.accelerator();
59 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); 59 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN);
60 60
61 command_list->Append(CreateCommandValue(iter->second, active)); 61 command_list->Append(CreateCommandValue(iter->second, active));
62 } 62 }
63 63
64 SetResult(command_list); 64 SetResult(command_list);
65 return true; 65 return true;
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698