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

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

Issue 2928113003: arc: Temporary workaround for enabling ARC Kiosk on N. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 151e460102347687ef2f92dbfa9b67848a15f2de..2930f79effc8b36e4756eb71ed5ed2b961b3747a 100644
--- a/chrome/browser/chromeos/arc/arc_util.cc
+++ b/chrome/browser/chromeos/arc/arc_util.cc
@@ -6,9 +6,11 @@
#include <linux/magic.h>
#include <sys/statfs.h>
+#include <set>
#include "base/callback.h"
#include "base/files/file_path.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/sys_info.h"
#include "base/task_scheduler/post_task.h"
@@ -39,6 +41,19 @@ bool g_disallow_for_testing = false;
// during test runs.
bool g_arc_blocked_due_to_incomaptible_filesystem_for_testing = false;
+// TODO(kinaba): Temporary workaround for crbug.com/729034.
+//
+// Some type of accounts don't have user prefs. As a short-term workaround,
+// store the compatibility info from them on memory, ignoring the defect that
+// it cannot survive browser crash and restart.
+//
+// This will be removed once the forced migration for ARC Kiosk user is
+// implemented. After it's done such types of accounts cannot even sign-in
+// with incompatible filesystem. Hence it'll be safe to always regard compatible
+// for them then.
+base::LazyInstance<std::set<AccountId>>::DestructorAtExit
+ g_known_compatible_users = LAZY_INSTANCE_INITIALIZER;
+
// Returns whether ARC can run on the filesystem mounted at |path|.
// This function should run only on threads where IO operations are allowed.
bool IsArcCompatibleFilesystem(const base::FilePath& path) {
@@ -51,6 +66,14 @@ bool IsArcCompatibleFilesystem(const base::FilePath& path) {
return statfs_buf.f_type != ECRYPTFS_SUPER_MAGIC;
}
+FileSystemCompatibilityState GetFileSystemCompatibilityPref(
+ const AccountId& account_id) {
+ int pref_value = kFileSystemIncompatible;
+ user_manager::known_user::GetIntegerPref(
+ account_id, prefs::kArcCompatibleFilesystemChosen, &pref_value);
+ return static_cast<FileSystemCompatibilityState>(pref_value);
+}
+
// Stores the result of IsArcCompatibleFilesystem posted back from the blocking
// task runner.
void StoreCompatibilityCheckResult(const AccountId& account_id,
@@ -60,18 +83,17 @@ void StoreCompatibilityCheckResult(const AccountId& account_id,
user_manager::known_user::SetIntegerPref(
account_id, prefs::kArcCompatibleFilesystemChosen,
arc::kFileSystemCompatible);
+
+ // TODO(kinaba): Remove this code for accounts without user prefs.
+ // See the comment for |g_known_compatible_users| for the detail.
+ if (GetFileSystemCompatibilityPref(account_id) !=
+ arc::kFileSystemCompatible) {
+ g_known_compatible_users.Get().insert(account_id);
+ }
}
callback.Run();
}
-FileSystemCompatibilityState GetFileSystemCompatibilityPref(
- const AccountId& account_id) {
- int pref_value = kFileSystemIncompatible;
- user_manager::known_user::GetIntegerPref(
- account_id, prefs::kArcCompatibleFilesystemChosen, &pref_value);
- return static_cast<FileSystemCompatibilityState>(pref_value);
-}
-
} // namespace
bool IsArcAllowedForProfile(const Profile* profile) {
@@ -160,7 +182,8 @@ bool IsArcCompatibleFileSystemUsedForProfile(const Profile* profile) {
FileSystemCompatibilityState filesystem_compatibility =
GetFileSystemCompatibilityPref(user->GetAccountId());
const bool is_filesystem_compatible =
- filesystem_compatibility != kFileSystemIncompatible;
+ filesystem_compatibility != kFileSystemIncompatible ||
+ g_known_compatible_users.Get().count(user->GetAccountId()) != 0;
std::string arc_sdk_version;
const bool is_M = base::SysInfo::GetLsbReleaseValue(kLsbReleaseArcVersionKey,
&arc_sdk_version) &&
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698