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/extensions/extension_keybinding_registry.h" | 5 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 9 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 content::BrowserContext* context, | 22 content::BrowserContext* context, |
23 ExtensionFilter extension_filter, | 23 ExtensionFilter extension_filter, |
24 Delegate* delegate) | 24 Delegate* delegate) |
25 : profile_(Profile::FromBrowserContext(context)), | 25 : profile_(Profile::FromBrowserContext(context)), |
26 extension_filter_(extension_filter), | 26 extension_filter_(extension_filter), |
27 delegate_(delegate) { | 27 delegate_(delegate) { |
28 registrar_.Add(this, | 28 registrar_.Add(this, |
29 chrome::NOTIFICATION_EXTENSION_LOADED, | 29 chrome::NOTIFICATION_EXTENSION_LOADED, |
30 content::Source<Profile>(profile_->GetOriginalProfile())); | 30 content::Source<Profile>(profile_->GetOriginalProfile())); |
31 registrar_.Add(this, | 31 registrar_.Add(this, |
32 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 32 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
33 content::Source<Profile>(profile_->GetOriginalProfile())); | 33 content::Source<Profile>(profile_->GetOriginalProfile())); |
34 registrar_.Add(this, | 34 registrar_.Add(this, |
35 chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED, | 35 chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED, |
36 content::Source<Profile>(profile_->GetOriginalProfile())); | 36 content::Source<Profile>(profile_->GetOriginalProfile())); |
37 registrar_.Add(this, | 37 registrar_.Add(this, |
38 chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED, | 38 chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED, |
39 content::Source<Profile>(profile_->GetOriginalProfile())); | 39 content::Source<Profile>(profile_->GetOriginalProfile())); |
40 } | 40 } |
41 | 41 |
42 ExtensionKeybindingRegistry::~ExtensionKeybindingRegistry() { | 42 ExtensionKeybindingRegistry::~ExtensionKeybindingRegistry() { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 const content::NotificationSource& source, | 170 const content::NotificationSource& source, |
171 const content::NotificationDetails& details) { | 171 const content::NotificationDetails& details) { |
172 switch (type) { | 172 switch (type) { |
173 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 173 case chrome::NOTIFICATION_EXTENSION_LOADED: { |
174 const extensions::Extension* extension = | 174 const extensions::Extension* extension = |
175 content::Details<const extensions::Extension>(details).ptr(); | 175 content::Details<const extensions::Extension>(details).ptr(); |
176 if (ExtensionMatchesFilter(extension)) | 176 if (ExtensionMatchesFilter(extension)) |
177 AddExtensionKeybinding(extension, std::string()); | 177 AddExtensionKeybinding(extension, std::string()); |
178 break; | 178 break; |
179 } | 179 } |
180 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 180 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
181 const extensions::Extension* extension = | 181 const extensions::Extension* extension = |
182 content::Details<UnloadedExtensionInfo>(details)->extension; | 182 content::Details<UnloadedExtensionInfo>(details)->extension; |
183 if (ExtensionMatchesFilter(extension)) | 183 if (ExtensionMatchesFilter(extension)) |
184 RemoveExtensionKeybinding(extension, std::string()); | 184 RemoveExtensionKeybinding(extension, std::string()); |
185 break; | 185 break; |
186 } | 186 } |
187 case chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED: | 187 case chrome::NOTIFICATION_EXTENSION_COMMAND_ADDED: |
188 case chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED: { | 188 case chrome::NOTIFICATION_EXTENSION_COMMAND_REMOVED: { |
189 std::pair<const std::string, const std::string>* payload = | 189 std::pair<const std::string, const std::string>* payload = |
190 content::Details<std::pair<const std::string, const std::string> >( | 190 content::Details<std::pair<const std::string, const std::string> >( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (extension_id.empty() || it->first == extension_id) { | 239 if (extension_id.empty() || it->first == extension_id) { |
240 CommandExecuted(it->first, it->second); | 240 CommandExecuted(it->first, it->second); |
241 executed = true; | 241 executed = true; |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 return executed; | 245 return executed; |
246 } | 246 } |
247 | 247 |
248 } // namespace extensions | 248 } // namespace extensions |
OLD | NEW |