Introduce profile for lock screen apps
Introduces the profile to be used to run lock screen apps, instead
of sign-in profile.
The profile behavior will be similar to sign-in profile, but using
separate profile allows better isolation between apps running on
login screen and apps running on lock screen (which have different set
of app/extension APIs available), and make inference of lock screen
extension context type more straight forward. Also, this will enable
us to make lock screen app profile ephemeral.
This also updates the way lock_screen_extension context is calculated,
allows background pages in the profile for lock screen apps, and
disables app autoupdates in the lock screen profile (since the app
versions in the profile should correspond to app versions in the user
profile).
BUG=715781,734698
Review-Url: https://codereview.chromium.org/2945023002
Cr-Commit-Position: refs/heads/master@{#483123}
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index b08bba2..763dbbbc 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -355,19 +355,6 @@
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
UpgradeDetector::GetInstance()->AddObserver(this);
@@ -465,7 +452,8 @@
bool load_saved_extensions = true;
bool load_command_line_extensions = extensions_enabled_;
#if defined(OS_CHROMEOS)
- if (chromeos::ProfileHelper::IsSigninProfile(profile_)) {
+ if (chromeos::ProfileHelper::IsSigninProfile(profile_) ||
+ chromeos::ProfileHelper::IsLockScreenAppProfile(profile_)) {
load_saved_extensions = false;
load_command_line_extensions = false;
}
@@ -2267,20 +2255,6 @@
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.";