1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/ui/webui/settings/chromeos/os_settings_features_util.h" 6 7 #include "base/feature_list.h" 8 #include "chrome/browser/chromeos/arc/arc_util.h" 9 #include "chrome/browser/policy/profile_policy_connector.h" 10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile_manager.h" 12 #include "components/arc/arc_features.h" 13 #include "components/user_manager/user_manager.h" 14 15 namespace chromeos { 16 namespace settings { 17 namespace features { 18 IsGuestModeActive()19bool IsGuestModeActive() { 20 return user_manager::UserManager::Get()->IsLoggedInAsGuest() || 21 user_manager::UserManager::Get()->IsLoggedInAsPublicAccount(); 22 } 23 ShouldShowParentalControlSettings(const Profile * profile)24bool ShouldShowParentalControlSettings(const Profile* profile) { 25 // Not shown for secondary users. 26 if (profile != ProfileManager::GetPrimaryUserProfile()) 27 return false; 28 29 // Also not shown for guest sessions. 30 if (profile->IsGuestSession()) 31 return false; 32 33 // Settings are for Family Link, not legacy parental controls 34 if (profile->IsLegacySupervised()) 35 return false; 36 37 return profile->IsChild() || 38 !profile->GetProfilePolicyConnector()->IsManaged(); 39 } 40 ShouldShowExternalStorageSettings(const Profile * profile)41bool ShouldShowExternalStorageSettings(const Profile* profile) { 42 return base::FeatureList::IsEnabled(arc::kUsbStorageUIFeature) && 43 arc::IsArcPlayStoreEnabledForProfile(profile); 44 } 45 46 } // namespace features 47 } // namespace settings 48 } // namespace chromeos 49