OLD | NEW |
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #endif | 92 #endif |
93 } | 93 } |
94 | 94 |
95 void CommandHandler::GetAllCommands(base::DictionaryValue* commands) { | 95 void CommandHandler::GetAllCommands(base::DictionaryValue* commands) { |
96 ListValue* results = new ListValue; | 96 ListValue* results = new ListValue; |
97 | 97 |
98 Profile* profile = Profile::FromWebUI(web_ui()); | 98 Profile* profile = Profile::FromWebUI(web_ui()); |
99 CommandService* command_service = | 99 CommandService* command_service = |
100 CommandServiceFactory::GetForProfile(profile); | 100 CommandServiceFactory::GetForProfile(profile); |
101 | 101 |
102 const ExtensionSet* extensions = | 102 const ExtensionSet* extensions = extensions::ExtensionSystem::Get(profile)-> |
103 ExtensionSystem::Get(profile)->extension_service()->extensions(); | 103 extension_service()->extensions(); |
104 for (ExtensionSet::const_iterator extension = extensions->begin(); | 104 for (ExtensionSet::const_iterator extension = extensions->begin(); |
105 extension != extensions->end(); ++extension) { | 105 extension != extensions->end(); ++extension) { |
106 scoped_ptr<DictionaryValue> extension_dict(new DictionaryValue); | 106 scoped_ptr<DictionaryValue> extension_dict(new DictionaryValue); |
107 extension_dict->SetString("name", (*extension)->name()); | 107 extension_dict->SetString("name", (*extension)->name()); |
108 extension_dict->SetString("id", (*extension)->id()); | 108 extension_dict->SetString("id", (*extension)->id()); |
109 | 109 |
110 // Add the keybindings to a list structure. | 110 // Add the keybindings to a list structure. |
111 scoped_ptr<ListValue> extensions_list(new ListValue()); | 111 scoped_ptr<ListValue> extensions_list(new ListValue()); |
112 | 112 |
113 bool active = false; | 113 bool active = false; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (!extensions_list->empty()) { | 146 if (!extensions_list->empty()) { |
147 extension_dict->Set("commands", extensions_list.release()); | 147 extension_dict->Set("commands", extensions_list.release()); |
148 results->Append(extension_dict.release()); | 148 results->Append(extension_dict.release()); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 commands->Set("commands", results); | 152 commands->Set("commands", results); |
153 } | 153 } |
154 | 154 |
155 } // namespace extensions | 155 } // namespace extensions |
OLD | NEW |