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

Unified Diff: chrome/browser/ui/webui/extensions/command_handler.cc

Issue 275503003: Remove deprecated extension notification and deprecated extension_service functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/extensions/command_handler.cc
diff --git a/chrome/browser/ui/webui/extensions/command_handler.cc b/chrome/browser/ui/webui/extensions/command_handler.cc
index e444592004a0845ba75671ee73296c95edbb210d..d9aeaa1a686425997e4c10e02abf6bb6fc3aaed5 100644
--- a/chrome/browser/ui/webui/extensions/command_handler.cc
+++ b/chrome/browser/ui/webui/extensions/command_handler.cc
@@ -6,14 +6,13 @@
#include "base/bind.h"
#include "base/values.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/commands/command_service.h"
#include "chrome/browser/extensions/extension_commands_global_registry.h"
#include "chrome/browser/extensions/extension_keybinding_registry.h"
-#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_set.h"
#include "grit/generated_resources.h"
@@ -21,7 +20,8 @@
namespace extensions {
-CommandHandler::CommandHandler(Profile* profile) : profile_(profile) {
+CommandHandler::CommandHandler(Profile* profile)
+ : profile_(profile), extension_registry_observer_(this) {
}
CommandHandler::~CommandHandler() {
@@ -46,11 +46,8 @@ void CommandHandler::GetLocalizedValues(content::WebUIDataSource* source) {
}
void CommandHandler::RegisterMessages() {
- registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
- content::Source<Profile>(profile_));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(profile_));
+ extension_registry_observer_.Add(
+ extensions::ExtensionRegistry::Get(profile_));
Devlin 2014/05/19 16:04:11 This is all in extensions namespace, so please rem
limasdf 2014/05/20 04:04:49 Done.
web_ui()->RegisterMessageCallback("extensionCommandsRequestExtensionsData",
base::Bind(&CommandHandler::HandleRequestExtensionsData,
@@ -66,12 +63,15 @@ void CommandHandler::RegisterMessages() {
base::Unretained(this)));
}
-void CommandHandler::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED ||
- type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED);
+void CommandHandler::OnExtensionLoaded(content::BrowserContext* browser_context,
+ const extensions::Extension* extension) {
+ UpdateCommandDataOnPage();
+}
+
+void CommandHandler::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension,
+ extensions::UnloadedExtensionInfo::Reason reason) {
UpdateCommandDataOnPage();
}
@@ -141,10 +141,11 @@ void CommandHandler::GetAllCommands(base::DictionaryValue* commands) {
Profile* profile = Profile::FromWebUI(web_ui());
CommandService* command_service = CommandService::Get(profile);
- const ExtensionSet* extensions = extensions::ExtensionSystem::Get(profile)->
- extension_service()->extensions();
- for (ExtensionSet::const_iterator extension = extensions->begin();
- extension != extensions->end(); ++extension) {
+ const ExtensionSet& extensions =
+ extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
+ for (ExtensionSet::const_iterator extension = extensions.begin();
+ extension != extensions.end();
+ ++extension) {
scoped_ptr<base::DictionaryValue> extension_dict(new base::DictionaryValue);
extension_dict->SetString("name", (*extension)->name());
extension_dict->SetString("id", (*extension)->id());

Powered by Google App Engine
This is Rietveld 408576698