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

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

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

Powered by Google App Engine
This is Rietveld 408576698