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

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

Issue 2149953002: Enable login screen apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Stefan feedback Created 3 years, 9 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/chrome_process_manager_delegate.cc
diff --git a/chrome/browser/extensions/chrome_process_manager_delegate.cc b/chrome/browser/extensions/chrome_process_manager_delegate.cc
index e5804aab7c89b436ade61cc18225ba081b7f3229..0fa3935c13c70c17af52c5b9765b680827a2707e 100644
--- a/chrome/browser/extensions/chrome_process_manager_delegate.cc
+++ b/chrome/browser/extensions/chrome_process_manager_delegate.cc
@@ -9,6 +9,7 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
@@ -19,8 +20,13 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_manager_factory.h"
+#include "extensions/common/extension.h"
#include "extensions/common/one_shot_event.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#endif
+
namespace extensions {
ChromeProcessManagerDelegate::ChromeProcessManagerDelegate() {
@@ -38,16 +44,12 @@ ChromeProcessManagerDelegate::ChromeProcessManagerDelegate() {
ChromeProcessManagerDelegate::~ChromeProcessManagerDelegate() {
}
-bool ChromeProcessManagerDelegate::IsBackgroundPageAllowed(
+bool ChromeProcessManagerDelegate::AreBackgroundPagesAllowedForContext(
content::BrowserContext* context) const {
- Profile* profile = static_cast<Profile*>(context);
+ Profile* profile = Profile::FromBrowserContext(context);
bool is_normal_session = !profile->IsGuestSession() &&
!profile->IsSystemProfile();
-#if defined(OS_CHROMEOS)
- is_normal_session = is_normal_session &&
- user_manager::UserManager::Get()->IsUserLoggedIn();
-#endif
// Disallow if the current session is a Guest mode session or login screen but
// the current browser context is *not* off-the-record. Such context is
@@ -56,9 +58,40 @@ bool ChromeProcessManagerDelegate::IsBackgroundPageAllowed(
return is_normal_session || profile->IsOffTheRecord();
}
+bool ChromeProcessManagerDelegate::IsExtensionBackgroundPageAllowed(
+ content::BrowserContext* context,
+ const Extension& extension) const {
+#if defined(OS_CHROMEOS)
+ Profile* profile = Profile::FromBrowserContext(context);
+
+ const bool is_signin_profile =
+ chromeos::ProfileHelper::IsSigninProfile(profile) &&
+ !profile->IsOffTheRecord();
+
+ if (is_signin_profile) {
+ // Check for flag.
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableLoginScreenApps)) {
+ return false;
+ }
+
+ // Get login screen apps installed by policy.
+ std::unique_ptr<base::DictionaryValue> login_screen_apps_list =
+ ExtensionManagementFactory::GetForBrowserContext(context)
+ ->GetForceInstallList();
+
+ // For the ChromeOS login profile, only allow apps installed by device
+ // policy.
+ return login_screen_apps_list->HasKey(extension.id());
+ }
+#endif
+
+ return AreBackgroundPagesAllowedForContext(context);
+}
+
bool ChromeProcessManagerDelegate::DeferCreatingStartupBackgroundHosts(
content::BrowserContext* context) const {
- Profile* profile = static_cast<Profile*>(context);
+ Profile* profile = Profile::FromBrowserContext(context);
// The profile may not be valid yet if it is still being initialized.
// In that case, defer loading, since it depends on an initialized profile.
« no previous file with comments | « chrome/browser/extensions/chrome_process_manager_delegate.h ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698