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

Unified Diff: chrome/browser/extensions/api/runtime/runtime_api.cc

Issue 101203008: Allow app_shell to run past extension manifest parsing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup register_manifest Created 6 years, 11 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 | « apps/shell/shell_extensions_client.cc ('k') | chrome/browser/extensions/extension_web_contents_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/runtime/runtime_api.cc
diff --git a/chrome/browser/extensions/api/runtime/runtime_api.cc b/chrome/browser/extensions/api/runtime/runtime_api.cc
index 03ce5ce9553dbb356d43fc8b60ae3911ac8733cb..05019017d1c52dfe9a183e2d68c8130baa3ee9d3 100644
--- a/chrome/browser/extensions/api/runtime/runtime_api.cc
+++ b/chrome/browser/extensions/api/runtime/runtime_api.cc
@@ -27,6 +27,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/lazy_background_task_queue.h"
#include "extensions/browser/process_manager.h"
@@ -73,24 +74,24 @@ const char kUninstallUrl[] = "uninstall_url";
// with the equivalent Pepper API.
const char kPackageDirectoryPath[] = "crxfs";
-static void DispatchOnStartupEventImpl(
- Profile* profile,
- const std::string& extension_id,
- bool first_call,
- ExtensionHost* host) {
+void DispatchOnStartupEventImpl(BrowserContext* browser_context,
+ const std::string& extension_id,
+ bool first_call,
+ ExtensionHost* host) {
// A NULL host from the LazyBackgroundTaskQueue means the page failed to
// load. Give up.
if (!host && !first_call)
return;
- // Don't send onStartup events to incognito profiles.
- if (profile->IsOffTheRecord())
+ // Don't send onStartup events to incognito browser contexts.
+ if (browser_context->IsOffTheRecord())
return;
- if (g_browser_process->IsShuttingDown() ||
- !g_browser_process->profile_manager()->IsValidProfile(profile))
+ if (ExtensionsBrowserClient::Get()->IsShuttingDown() ||
+ !ExtensionsBrowserClient::Get()->IsValidContext(browser_context))
return;
- ExtensionSystem* system = ExtensionSystem::Get(profile);
+ ExtensionSystem* system =
+ ExtensionSystem::GetForBrowserContext(browser_context);
if (!system)
return;
@@ -98,15 +99,16 @@ static void DispatchOnStartupEventImpl(
// (it might not be ready, since this is startup). But only enqueue once.
// If it fails to load the first time, don't bother trying again.
const Extension* extension =
- system->extension_service()->extensions()->GetByID(extension_id);
+ ExtensionRegistry::Get(browser_context)->enabled_extensions().GetByID(
+ extension_id);
if (extension && BackgroundInfo::HasPersistentBackgroundPage(extension) &&
first_call &&
system->lazy_background_task_queue()->
- ShouldEnqueueTask(profile, extension)) {
+ ShouldEnqueueTask(browser_context, extension)) {
system->lazy_background_task_queue()->AddPendingTask(
- profile, extension_id,
+ browser_context, extension_id,
base::Bind(&DispatchOnStartupEventImpl,
- profile, extension_id, false));
+ browser_context, extension_id, false));
return;
}
@@ -260,9 +262,7 @@ void RuntimeAPI::OnChromeUpdateAvailable() {
// static
void RuntimeEventRouter::DispatchOnStartupEvent(
content::BrowserContext* context, const std::string& extension_id) {
- // TODO(jamescook): Convert to BrowserContext all the way down.
- Profile* profile = static_cast<Profile*>(context);
- DispatchOnStartupEventImpl(profile, extension_id, true, NULL);
+ DispatchOnStartupEventImpl(context, extension_id, true, NULL);
}
// static
« no previous file with comments | « apps/shell/shell_extensions_client.cc ('k') | chrome/browser/extensions/extension_web_contents_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698