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

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

Issue 2892403002: Introduce lock screen app context to extension features (Closed)
Patch Set: . Created 3 years, 6 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 865438513dd39f0ea0d461506492a3c0736b8112..37045a0e3d52f5acdd4ef9c84c5a5e145c7c06c5 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -352,6 +352,19 @@ ExtensionService::ExtensionService(Profile* profile,
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
content::Source<Profile>(profile_));
+#if defined(OS_CHROMEOS)
+ // Sign in profile extension service should observe session start - when the
+ // session is started, the context's process map should be updated to consider
+ // extension scripts to run in lock screen context (as the sign-in profile
+ // will be used to host lock screen apps from that point).
+ // TODO(tbarzic): Consider introducing a profile dedicated to lock screen apps
+ // so the process map's 'is lock screen context' flag does not have to be
+ // changed when the user session starts.
+ if (chromeos::ProfileHelper::IsSigninProfile(profile_)) {
+ registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED,
+ content::NotificationService::AllSources());
+ }
+#endif
extensions::ExtensionManagementFactory::GetForBrowserContext(profile_)
->AddObserver(this);
@@ -2258,6 +2271,20 @@ void ExtensionService::Observe(int type,
OnProfileDestructionStarted();
break;
}
+#if defined(OS_CHROMEOS)
+ case chrome::NOTIFICATION_SESSION_STARTED: {
+ DCHECK(chromeos::ProfileHelper::IsSigninProfile(profile_));
+
+ // When the user session starts, mark the signin context as lock screen
+ // context, as it will be used to host apps on lock screen.
+ extensions::ProcessMap::Get(profile_)->set_is_lock_screen_context(true);
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::BindOnce(&extensions::InfoMap::SetIsLockScreenContext,
+ system_->info_map(), true));
+ break;
+ }
+#endif
default:
NOTREACHED() << "Unexpected notification type.";
« no previous file with comments | « chrome/browser/extensions/chrome_extensions_browser_client.cc ('k') | chrome/common/extensions/api/_features.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698