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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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/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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // Add the keybindings to a list structure. 123 // Add the keybindings to a list structure.
124 scoped_ptr<ListValue> extensions_list(new ListValue()); 124 scoped_ptr<ListValue> extensions_list(new ListValue());
125 125
126 bool active = false; 126 bool active = false;
127 127
128 extensions::Command browser_action; 128 extensions::Command browser_action;
129 if (command_service->GetBrowserActionCommand((*extension)->id(), 129 if (command_service->GetBrowserActionCommand((*extension)->id(),
130 CommandService::ALL, 130 CommandService::ALL,
131 &browser_action, 131 &browser_action,
132 &active)) { 132 &active)) {
133 extensions_list->Append(browser_action.ToValue((*extension), active)); 133 extensions_list->
134 Append(browser_action.ToValue((*extension).get(), active));
134 } 135 }
135 136
136 extensions::Command page_action; 137 extensions::Command page_action;
137 if (command_service->GetPageActionCommand((*extension)->id(), 138 if (command_service->GetPageActionCommand((*extension)->id(),
138 CommandService::ALL, 139 CommandService::ALL,
139 &page_action, 140 &page_action,
140 &active)) { 141 &active)) {
141 extensions_list->Append(page_action.ToValue((*extension), active)); 142 extensions_list->Append(page_action.ToValue((*extension).get(), active));
142 } 143 }
143 144
144 extensions::Command script_badge; 145 extensions::Command script_badge;
145 if (command_service->GetScriptBadgeCommand((*extension)->id(), 146 if (command_service->GetScriptBadgeCommand((*extension)->id(),
146 CommandService::ALL, 147 CommandService::ALL,
147 &script_badge, 148 &script_badge,
148 &active)) { 149 &active)) {
149 extensions_list->Append(script_badge.ToValue((*extension), active)); 150 extensions_list->Append(script_badge.ToValue((*extension).get(), active));
150 } 151 }
151 152
152 extensions::CommandMap named_commands; 153 extensions::CommandMap named_commands;
153 if (command_service->GetNamedCommands((*extension)->id(), 154 if (command_service->GetNamedCommands((*extension)->id(),
154 CommandService::ALL, 155 CommandService::ALL,
155 &named_commands)) { 156 &named_commands)) {
156 for (extensions::CommandMap::const_iterator iter = named_commands.begin(); 157 for (extensions::CommandMap::const_iterator iter = named_commands.begin();
157 iter != named_commands.end(); ++iter) { 158 iter != named_commands.end(); ++iter) {
158 ui::Accelerator shortcut_assigned = 159 ui::Accelerator shortcut_assigned =
159 command_service->FindShortcutForCommand( 160 command_service->FindShortcutForCommand(
160 (*extension)->id(), iter->second.command_name()); 161 (*extension)->id(), iter->second.command_name());
161 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); 162 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN);
162 163
163 extensions_list->Append(iter->second.ToValue((*extension), active)); 164 extensions_list->
165 Append(iter->second.ToValue((*extension).get(), active));
164 } 166 }
165 } 167 }
166 168
167 if (!extensions_list->empty()) { 169 if (!extensions_list->empty()) {
168 extension_dict->Set("commands", extensions_list.release()); 170 extension_dict->Set("commands", extensions_list.release());
169 results->Append(extension_dict.release()); 171 results->Append(extension_dict.release());
170 } 172 }
171 } 173 }
172 174
173 commands->Set("commands", results); 175 commands->Set("commands", results);
174 } 176 }
175 177
176 } // namespace extensions 178 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/devtools_ui.cc ('k') | chrome/browser/ui/webui/extensions/pack_extension_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698