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