Commit 17221403 authored by limasdf's avatar limasdf Committed by Commit bot

Remove NOTIFICATION_EXTENSIONS_READY from ephemeral_app_service.cc

Use ExtensionSystem::Ready instead of NOTIFICATION_EXTENSIONS_READY.

R=kalman@chromium.org
BUG=354459

Review URL: https://codereview.chromium.org/1102193002

Cr-Commit-Position: refs/heads/master@{#327171}
parent 962fc225
...@@ -8,22 +8,18 @@ ...@@ -8,22 +8,18 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "chrome/browser/apps/ephemeral_app_service_factory.h" #include "chrome/browser/apps/ephemeral_app_service_factory.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h" #include "extensions/browser/extension_util.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/uninstall_reason.h" #include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/extension_set.h" #include "extensions/common/extension_set.h"
#include "extensions/common/one_shot_event.h"
using extensions::Extension; using extensions::Extension;
using extensions::ExtensionPrefs; using extensions::ExtensionPrefs;
...@@ -71,9 +67,9 @@ EphemeralAppService::EphemeralAppService(Profile* profile) ...@@ -71,9 +67,9 @@ EphemeralAppService::EphemeralAppService(Profile* profile)
ephemeral_app_count_(-1), ephemeral_app_count_(-1),
disable_idle_app_delay_(kDefaultDisableAppDelay), disable_idle_app_delay_(kDefaultDisableAppDelay),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
registrar_.Add(this, ExtensionSystem::Get(profile_)->ready().Post(
extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED, FROM_HERE,
content::Source<Profile>(profile_)); base::Bind(&EphemeralAppService::Init, weak_ptr_factory_.GetWeakPtr()));
} }
EphemeralAppService::~EphemeralAppService() { EphemeralAppService::~EphemeralAppService() {
...@@ -115,20 +111,6 @@ void EphemeralAppService::ClearCachedApps() { ...@@ -115,20 +111,6 @@ void EphemeralAppService::ClearCachedApps() {
} }
} }
void EphemeralAppService::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: {
Init();
break;
}
default:
NOTREACHED();
}
}
void EphemeralAppService::OnExtensionWillBeInstalled( void EphemeralAppService::OnExtensionWillBeInstalled(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
const extensions::Extension* extension, const extensions::Extension* extension,
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_ #ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
#define CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_ #define CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
#include <map>
#include <set> #include <set>
#include "apps/app_lifetime_monitor.h" #include "apps/app_lifetime_monitor.h"
...@@ -13,8 +12,6 @@ ...@@ -13,8 +12,6 @@
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/extension_registry_observer.h" #include "extensions/browser/extension_registry_observer.h"
class Profile; class Profile;
...@@ -26,7 +23,6 @@ class ExtensionRegistry; ...@@ -26,7 +23,6 @@ class ExtensionRegistry;
// Performs the background garbage collection of ephemeral apps. // Performs the background garbage collection of ephemeral apps.
class EphemeralAppService : public KeyedService, class EphemeralAppService : public KeyedService,
public content::NotificationObserver,
public extensions::ExtensionRegistryObserver, public extensions::ExtensionRegistryObserver,
public apps::AppLifetimeMonitor::Observer { public apps::AppLifetimeMonitor::Observer {
public: public:
...@@ -60,11 +56,6 @@ class EphemeralAppService : public KeyedService, ...@@ -60,11 +56,6 @@ class EphemeralAppService : public KeyedService,
// A map used to order the ephemeral apps by their last launch time. // A map used to order the ephemeral apps by their last launch time.
typedef std::multimap<base::Time, std::string> LaunchTimeAppMap; typedef std::multimap<base::Time, std::string> LaunchTimeAppMap;
// content::NotificationObserver implementation.
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// extensions::ExtensionRegistryObserver. // extensions::ExtensionRegistryObserver.
void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
const extensions::Extension* extension, const extensions::Extension* extension,
...@@ -96,7 +87,6 @@ class EphemeralAppService : public KeyedService, ...@@ -96,7 +87,6 @@ class EphemeralAppService : public KeyedService,
Profile* profile_; Profile* profile_;
content::NotificationRegistrar registrar_;
ScopedObserver<extensions::ExtensionRegistry, ScopedObserver<extensions::ExtensionRegistry,
extensions::ExtensionRegistryObserver> extensions::ExtensionRegistryObserver>
extension_registry_observer_; extension_registry_observer_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment