| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/arc/arc_util.h" | 5 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 6 | 6 |
| 7 #include <linux/magic.h> | 7 #include <linux/magic.h> |
| 8 #include <sys/statfs.h> | 8 #include <sys/statfs.h> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 if (!IsArcAllowedForProfile(profile)) { | 156 if (!IsArcAllowedForProfile(profile)) { |
| 157 LOG(DFATAL) << "ARC is not allowed for profile"; | 157 LOG(DFATAL) << "ARC is not allowed for profile"; |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 return profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled); | 160 return profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) { | 163 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) { |
| 164 DCHECK(IsArcAllowedForProfile(profile)); | 164 DCHECK(IsArcAllowedForProfile(profile)); |
| 165 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) { | 165 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) { |
| 166 if (enabled && !IsArcPlayStoreEnabledForProfile(profile)) { |
| 167 LOG(WARNING) << "Attempt to enable disabled by policy ARC."; |
| 168 return; |
| 169 } |
| 166 VLOG(1) << "Google-Play-Store-enabled pref is managed. Request to " | 170 VLOG(1) << "Google-Play-Store-enabled pref is managed. Request to " |
| 167 << (enabled ? "enable" : "disable") << " Play Store is not stored"; | 171 << (enabled ? "enable" : "disable") << " Play Store is not stored"; |
| 168 // Need update ARC session manager manually for managed case in order to | 172 // Need update ARC session manager manually for managed case in order to |
| 169 // keep its state up to date, otherwise it may stuck with enabling | 173 // keep its state up to date, otherwise it may stuck with enabling |
| 170 // request. | 174 // request. |
| 171 // TODO (khmel): Consider finding the better way handling this. | 175 // TODO (khmel): Consider finding the better way handling this. |
| 172 ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); | 176 ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); |
| 173 // |arc_session_manager| can be nullptr in unit_tests. | 177 // |arc_session_manager| can be nullptr in unit_tests. |
| 174 if (!arc_session_manager) | 178 if (!arc_session_manager) |
| 175 return; | 179 return; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 193 base::ThreadRestrictions::AssertIOAllowed(); | 197 base::ThreadRestrictions::AssertIOAllowed(); |
| 194 | 198 |
| 195 // If it can be verified it is not on ecryptfs, then it is ok. | 199 // If it can be verified it is not on ecryptfs, then it is ok. |
| 196 struct statfs statfs_buf; | 200 struct statfs statfs_buf; |
| 197 if (statfs(path.value().c_str(), &statfs_buf) < 0) | 201 if (statfs(path.value().c_str(), &statfs_buf) < 0) |
| 198 return false; | 202 return false; |
| 199 return statfs_buf.f_type != ECRYPTFS_SUPER_MAGIC; | 203 return statfs_buf.f_type != ECRYPTFS_SUPER_MAGIC; |
| 200 } | 204 } |
| 201 | 205 |
| 202 } // namespace arc | 206 } // namespace arc |
| OLD | NEW |