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

Side by Side Diff: chrome/browser/extensions/extension_keybinding_registry.cc

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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
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/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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/extensions/command.h" 12 #include "chrome/common/extensions/command.h"
13 #include "content/public/browser/browser_context.h" 13 #include "content/public/browser/browser_context.h"
14 #include "extensions/browser/event_router.h" 14 #include "extensions/browser/event_router.h"
15 #include "extensions/browser/extension_system.h" 15 #include "extensions/browser/extension_system.h"
16 #include "extensions/common/extension_set.h" 16 #include "extensions/common/extension_set.h"
17 #include "extensions/common/manifest_constants.h" 17 #include "extensions/common/manifest_constants.h"
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 ExtensionKeybindingRegistry::ExtensionKeybindingRegistry( 21 ExtensionKeybindingRegistry::ExtensionKeybindingRegistry(
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_DEPRECATED,
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_DEPRECATED, 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()));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const std::string& extension_id, 163 const std::string& extension_id,
164 const ui::Accelerator& accelerator) { 164 const ui::Accelerator& accelerator) {
165 ExecuteCommands(accelerator, extension_id); 165 ExecuteCommands(accelerator, extension_id);
166 } 166 }
167 167
168 void ExtensionKeybindingRegistry::Observe( 168 void ExtensionKeybindingRegistry::Observe(
169 int type, 169 int type,
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_DEPRECATED: {
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_DEPRECATED: { 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))
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_gcm_app_handler.cc ('k') | chrome/browser/extensions/extension_notification_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698