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

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

Issue 418413003: Remove deprecated ...EXTENSION_READY... from user_script_master.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « chrome/browser/extensions/user_script_master.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_master.cc
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 5fce82bbba8211cc542ddb4c8dd2306fdbf01346..80916b7fc92e4a67d7bd15d971fe5a879659c697 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -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,36 +439,26 @@ 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: {
- content::RenderProcessHost* process =
- content::Source<content::RenderProcessHost>(source).ptr();
- Profile* profile = Profile::FromBrowserContext(
- process->GetBrowserContext());
- if (!profile_->IsSameProfile(profile))
- return;
- if (ScriptsReady()) {
- SendUpdate(process,
- GetSharedMemory(),
- std::set<std::string>()); // Include all extensions.
- }
- break;
- }
- default:
- DCHECK(false);
+ DCHECK_EQ(type, content::NOTIFICATION_RENDERER_PROCESS_CREATED);
+ content::RenderProcessHost* process =
+ content::Source<content::RenderProcessHost>(source).ptr();
+ Profile* profile = Profile::FromBrowserContext(
+ process->GetBrowserContext());
+ if (!profile_->IsSameProfile(profile))
+ return;
+ if (ScriptsReady()) {
+ SendUpdate(process,
+ GetSharedMemory(),
+ std::set<std::string>()); // Include all extensions.
}
+}
- if (should_start_load) {
- if (is_loading())
- pending_load_ = true;
- else
- StartLoad();
- }
+void UserScriptMaster::OnExtensionsReady() {
+ extensions_service_ready_ = true;
+ if (is_loading())
+ pending_load_ = true;
+ else
+ StartLoad();
}
void UserScriptMaster::StartLoad() {
« no previous file with comments | « chrome/browser/extensions/user_script_master.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698