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

Unified Diff: chrome/browser/chromeos/arc/arc_util.cc

Issue 2806443002: arc: Add IsArcAllowedInAppListForProfile. (Closed)
Patch Set: Test Created 3 years, 8 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/chromeos/arc/arc_util.cc
diff --git a/chrome/browser/chromeos/arc/arc_util.cc b/chrome/browser/chromeos/arc/arc_util.cc
index b785728a93a13293dcb8185ff9fea389b21fa197..4e8d5e6e7fa8cdb7f0206f896718d55f69a2e68e 100644
--- a/chrome/browser/chromeos/arc/arc_util.cc
+++ b/chrome/browser/chromeos/arc/arc_util.cc
@@ -35,6 +35,22 @@ bool g_disallow_for_testing = false;
} // namespace
bool IsArcAllowedForProfile(const Profile* profile) {
+ if (!IsArcAllowedInAppListForProfile(profile))
+ return false;
+
+ if (base::SysInfo::IsRunningOnChromeOS()) {
+ // Do not allow newer version of ARC on old filesystem.
+ // Check this condition only on real Chrome OS devices. Test runs on Linux
+ // workstation does not have expected /etc/lsb-release field nor profile
+ // creation step.
+ if (!IsProfileVerifiedToBeOnArcCompatibleFilesystem(profile))
+ return false;
+ }
+
+ return true;
+}
+
+bool IsArcAllowedInAppListForProfile(const Profile* profile) {
if (g_disallow_for_testing) {
VLOG(1) << "ARC is disallowed for testing.";
return false;
@@ -101,28 +117,27 @@ bool IsArcAllowedForProfile(const Profile* profile) {
return false;
}
- // Do not allow newer version of ARC on old filesystem.
- // Check this condition only on real Chrome OS devices. Test runs on Linux
- // workstation does not have expected /etc/lsb-release field nor profile
- // creation step.
- if (base::SysInfo::IsRunningOnChromeOS()) {
- // chromeos::UserSessionManager::PrepareProfile does the actual file system
- // check and stores the result to prefs, so that it survives crash-restart.
- const bool is_filesystem_compatible =
- profile->GetPrefs()->GetBoolean(prefs::kArcCompatibleFilesystemChosen);
- std::string arc_sdk_version;
- const bool is_M = base::SysInfo::GetLsbReleaseValue(
- kLsbReleaseArcVersionKey, &arc_sdk_version) &&
- arc_sdk_version == kAndroidMSdkVersion;
- // To run ARC we want to make sure either
- // - Underlying file system is compatible with ARC, or
- // - SDK version is M.
- if (!is_filesystem_compatible && !is_M) {
- VLOG(1)
- << "Users with SDK version (" << arc_sdk_version
- << ") are not supported when they postponed to migrate to dircrypto.";
- return false;
- }
+ return true;
+}
+
+bool IsProfileVerifiedToBeOnArcCompatibleFilesystem(const Profile* profile) {
+ // chromeos::UserSessionManager::PrepareProfile does the actual file system
+ // check and stores the result to prefs, so that it survives crash-restart.
+ const bool is_filesystem_compatible =
+ profile->GetPrefs()->GetBoolean(prefs::kArcCompatibleFilesystemChosen);
+ std::string arc_sdk_version;
+ const bool is_M = base::SysInfo::GetLsbReleaseValue(kLsbReleaseArcVersionKey,
+ &arc_sdk_version) &&
+ arc_sdk_version == kAndroidMSdkVersion;
+
+ // To run ARC we want to make sure either
+ // - Underlying file system is compatible with ARC, or
+ // - SDK version is M.
+ if (!is_filesystem_compatible && !is_M) {
+ VLOG(1)
+ << "Users with SDK version (" << arc_sdk_version
+ << ") are not supported when they postponed to migrate to dircrypto.";
+ return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698