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

Unified Diff: chrome/browser/extensions/extension_keybinding_registry.cc

Issue 709813004: Remove the deprecated function ExtensionService::extensions(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thestig@'s comments. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_keybinding_registry.cc
diff --git a/chrome/browser/extensions/extension_keybinding_registry.cc b/chrome/browser/extensions/extension_keybinding_registry.cc
index 40c7712147e0c331ee932d59a311277932eff1a9..dae15fd8b0561f973cf6181f7880a041c2bd3566 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.cc
+++ b/chrome/browser/extensions/extension_keybinding_registry.cc
@@ -6,13 +6,11 @@
#include "base/values.h"
#include "chrome/browser/extensions/active_tab_permission_granter.h"
-#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/command.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/extension_system.h"
#include "extensions/browser/notification_types.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_constants.h"
@@ -75,16 +73,14 @@ void ExtensionKeybindingRegistry::RemoveExtensionKeybinding(
}
void ExtensionKeybindingRegistry::Init() {
- ExtensionService* service =
- ExtensionSystem::Get(browser_context_)->extension_service();
- if (!service)
- return; // ExtensionService can be null during testing.
-
- const ExtensionSet* extensions = service->extensions();
- ExtensionSet::const_iterator iter = extensions->begin();
- for (; iter != extensions->end(); ++iter)
- if (ExtensionMatchesFilter(iter->get()))
- AddExtensionKeybinding(iter->get(), std::string());
+ ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_);
+ if (!registry)
+ return; // ExtensionRegistry can be null during testing.
+
+ for (const scoped_refptr<const extensions::Extension>& extension :
+ registry->enabled_extensions())
+ if (ExtensionMatchesFilter(extension.get()))
+ AddExtensionKeybinding(extension.get(), std::string());
}
bool ExtensionKeybindingRegistry::ShouldIgnoreCommand(
@@ -100,10 +96,9 @@ bool ExtensionKeybindingRegistry::NotifyEventTargets(
void ExtensionKeybindingRegistry::CommandExecuted(
const std::string& extension_id, const std::string& command) {
- ExtensionService* service =
- ExtensionSystem::Get(browser_context_)->extension_service();
-
- const Extension* extension = service->extensions()->GetByID(extension_id);
+ const Extension* extension = ExtensionRegistry::Get(browser_context_)
+ ->enabled_extensions()
+ .GetByID(extension_id);
if (!extension)
return;
@@ -194,10 +189,9 @@ void ExtensionKeybindingRegistry::Observe(
content::Details<std::pair<const std::string, const std::string> >(
details).ptr();
- const Extension* extension = ExtensionSystem::Get(browser_context_)
- ->extension_service()
- ->extensions()
- ->GetByID(payload->first);
+ const Extension* extension = ExtensionRegistry::Get(browser_context_)
+ ->enabled_extensions()
+ .GetByID(payload->first);
// During install and uninstall the extension won't be found. We'll catch
// those events above, with the LOADED/UNLOADED, so we ignore this event.
if (!extension)
« no previous file with comments | « chrome/browser/extensions/extension_functional_browsertest.cc ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698