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

Unified Diff: chrome/browser/ui/ash/session_state_delegate_chromeos.cc

Issue 374853002: Providing more information on why certain users can't be added to multi-profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
Index: chrome/browser/ui/ash/session_state_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
index 286e2db3c549ad299a0774ea419e8f365ccdc747..0252778766e7730b236492fee654b836cb3aa3bf 100644
--- a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
@@ -11,7 +11,10 @@
#include "base/prefs/pref_service.h"
#include "chrome/browser/chromeos/login/lock/screen_locker.h"
#include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
+#include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
#include "chrome/browser/chromeos/login/users/user_manager.h"
+#include "chrome/browser/chromeos/policy/policy_cert_service.h"
+#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -207,6 +210,31 @@ void SessionStateDelegateChromeos::CycleActiveUser(CycleUser cycle_user) {
chromeos::UserManager::Get()->SwitchActiveUser(user_id);
}
+ash::SessionStateDelegate::PrimaryUserPolicy
+SessionStateDelegateChromeos::GetPrimaryUserPolicy() const {
dzhioev (left Google) 2014/08/06 12:37:39 This method is identical to the part of MultiProfi
Roman Sorokin (ftl) 2014/08/08 09:22:00 Done.
+ chromeos::UserManager* user_manager = chromeos::UserManager::Get();
+ CHECK(user_manager);
+
+ const user_manager::User* primary_user = user_manager->GetPrimaryUser();
+ if (!primary_user)
+ return ash::SessionStateDelegate::PRIMARY_USER_POLICY_ALLOW;
+ Profile* primary_user_profile =
+ chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user);
+ const std::string primary_user_behavior =
+ primary_user_profile->GetPrefs()->GetString(
+ prefs::kMultiProfileUserBehavior);
+ if (primary_user_behavior ==
+ chromeos::MultiProfileUserController::kBehaviorNotAllowed)
+ return ash::SessionStateDelegate::PRIMARY_USER_POLICY_FORBIDS;
+
+ policy::PolicyCertService* service =
+ policy::PolicyCertServiceFactory::GetForProfile(primary_user_profile);
+ if (service && service->has_policy_certificates())
+ return ash::SessionStateDelegate::PRIMARY_USER_POLICY_CERT_TAINTED;
+
+ return ash::SessionStateDelegate::PRIMARY_USER_POLICY_ALLOW;
+}
+
void SessionStateDelegateChromeos::AddSessionStateObserver(
ash::SessionStateObserver* observer) {
session_state_observer_list_.AddObserver(observer);

Powered by Google App Engine
This is Rietveld 408576698