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

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

Issue 2702723002: Extract kArcEnabled preference from ArcSessionManager part 1. (Closed)
Patch Set: Address comments. Created 3 years, 10 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 de722a70e63ff37ee2cf24ba237e3a0f4fc0cf71..3711b4949f49a3eda69d398e9f1a9fc411457f97 100644
--- a/chrome/browser/chromeos/arc/arc_util.cc
+++ b/chrome/browser/chromeos/arc/arc_util.cc
@@ -9,7 +9,9 @@
#include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
#include "components/arc/arc_util.h"
+#include "components/prefs/pref_service.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
@@ -96,4 +98,23 @@ void DisallowArcForTesting() {
g_disallow_for_testing = true;
}
+bool IsArcPlayStoreEnabledForProfile(const Profile* profile) {
+ return IsArcAllowedForProfile(profile) &&
+ profile->GetPrefs()->GetBoolean(prefs::kArcEnabled);
+}
+
+bool IsArcPlayStoreEnabledPreferenceManagedForProfile(const Profile* profile) {
+ DCHECK(IsArcAllowedForProfile(profile));
Luis Héctor Chávez 2017/02/21 16:50:01 Similar to the comments I left below: this is a pr
hidehiko 2017/02/21 17:25:14 This is not behavior change actually. In the old c
Luis Héctor Chávez 2017/02/21 18:18:08 Makes sense, but it's still something that can be
hidehiko 2017/02/23 04:17:36 Done. BTW, LOG(DFATAL) is the way in this case :-)
+ return profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled);
+}
+
+void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) {
+ DCHECK(IsArcAllowedForProfile(profile));
+ if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) {
+ VLOG(1) << "Do nothing, if the Google-Play-Store-enabled pref is managed.";
Luis Héctor Chávez 2017/02/21 16:50:02 nit: "Doing nothing since the Google-Play-Store-en
hidehiko 2017/02/21 17:25:14 Done.
+ return;
+ }
+ profile->GetPrefs()->SetBoolean(prefs::kArcEnabled, enabled);
+}
+
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698