Commit 131359c4 authored by limasdf@gmail.com's avatar limasdf@gmail.com

Remove deprecated ...EXTENSION_READY from user_script_master.cc

R=rockot@chromium.org
BUG=354046

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287365 0039d316-1c4b-4281-b951-d872f2087c98
parent ac0b5b8a
......@@ -25,6 +25,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/file_util.h"
#include "extensions/common/one_shot_event.h"
#include "extensions/common/message_bundle.h"
#include "ui/base/resource/resource_bundle.h"
......@@ -350,11 +351,12 @@ UserScriptMaster::UserScriptMaster(Profile* profile)
extension_registry_observer_(this),
weak_factory_(this) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED,
content::Source<Profile>(profile_));
registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
content::NotificationService::AllBrowserContextsAndSources());
ExtensionSystem::Get(profile)->ready().Post(
FROM_HERE,
base::Bind(&UserScriptMaster::OnExtensionsReady,
weak_factory_.GetWeakPtr()));
}
UserScriptMaster::~UserScriptMaster() {
......@@ -437,13 +439,7 @@ void UserScriptMaster::OnExtensionUnloaded(
void UserScriptMaster::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
bool should_start_load = false;
switch (type) {
case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED:
extensions_service_ready_ = true;
should_start_load = true;
break;
case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
DCHECK_EQ(type, content::NOTIFICATION_RENDERER_PROCESS_CREATED);
content::RenderProcessHost* process =
content::Source<content::RenderProcessHost>(source).ptr();
Profile* profile = Profile::FromBrowserContext(
......@@ -455,18 +451,14 @@ void UserScriptMaster::Observe(int type,
GetSharedMemory(),
std::set<std::string>()); // Include all extensions.
}
break;
}
default:
DCHECK(false);
}
}
if (should_start_load) {
void UserScriptMaster::OnExtensionsReady() {
extensions_service_ready_ = true;
if (is_loading())
pending_load_ = true;
else
StartLoad();
}
}
void UserScriptMaster::StartLoad() {
......
......@@ -80,6 +80,9 @@ class UserScriptMaster : public content::NotificationObserver,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) OVERRIDE;
// Called when ExtensionSystem is ready.
void OnExtensionsReady();
// Called once we have finished loading the scripts on the file thread.
void OnScriptsLoaded(scoped_ptr<UserScriptList> user_scripts,
scoped_ptr<base::SharedMemory> shared_memory);
......
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