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

Side by Side Diff: chrome/browser/ui/webui/extensions/command_handler.cc

Issue 10834106: Implement Keybinding for script badges. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/ui/webui/extensions/command_handler.h" 5 #include "chrome/browser/ui/webui/extensions/command_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/api/commands/command_service.h" 9 #include "chrome/browser/extensions/api/commands/command_service.h"
10 #include "chrome/browser/extensions/api/commands/command_service_factory.h" 10 #include "chrome/browser/extensions/api/commands/command_service_factory.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 extensions::Command page_action; 123 extensions::Command page_action;
124 if (command_service->GetPageActionCommand((*extension)->id(), 124 if (command_service->GetPageActionCommand((*extension)->id(),
125 CommandService::ALL, 125 CommandService::ALL,
126 &page_action, 126 &page_action,
127 &active)) { 127 &active)) {
128 extensions_list->Append(page_action.ToValue((*extension), active)); 128 extensions_list->Append(page_action.ToValue((*extension), active));
129 } 129 }
130 130
131 extensions::Command script_badge;
132 if (command_service->GetScriptBadgeCommand((*extension)->id(),
133 CommandService::ALL,
134 &script_badge,
135 &active)) {
136 extensions_list->Append(script_badge.ToValue((*extension), active));
137 }
138
131 extensions::CommandMap named_commands; 139 extensions::CommandMap named_commands;
132 if (command_service->GetNamedCommands((*extension)->id(), 140 if (command_service->GetNamedCommands((*extension)->id(),
133 CommandService::ALL, 141 CommandService::ALL,
134 &named_commands)) { 142 &named_commands)) {
135 for (extensions::CommandMap::const_iterator iter = named_commands.begin(); 143 for (extensions::CommandMap::const_iterator iter = named_commands.begin();
136 iter != named_commands.end(); ++iter) { 144 iter != named_commands.end(); ++iter) {
137 ui::Accelerator shortcut_assigned = 145 ui::Accelerator shortcut_assigned =
138 command_service->FindShortcutForCommand( 146 command_service->FindShortcutForCommand(
139 (*extension)->id(), iter->second.command_name()); 147 (*extension)->id(), iter->second.command_name());
140 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); 148 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN);
141 149
142 extensions_list->Append(iter->second.ToValue((*extension), active)); 150 extensions_list->Append(iter->second.ToValue((*extension), active));
143 } 151 }
144 } 152 }
145 153
146 if (!extensions_list->empty()) { 154 if (!extensions_list->empty()) {
147 extension_dict->Set("commands", extensions_list.release()); 155 extension_dict->Set("commands", extensions_list.release());
148 results->Append(extension_dict.release()); 156 results->Append(extension_dict.release());
149 } 157 }
150 } 158 }
151 159
152 commands->Set("commands", results); 160 commands->Set("commands", results);
153 } 161 }
154 162
155 } // namespace extensions 163 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698