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

Side by Side 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 unified diff | Download patch
OLDNEW
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/chromeos/login/user_flow.h" 8 #include "chrome/browser/chromeos/login/user_flow.h"
9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" 10 #include "chrome/browser/chromeos/profiles/profile_helper.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/pref_names.h"
12 #include "components/arc/arc_util.h" 13 #include "components/arc/arc_util.h"
14 #include "components/prefs/pref_service.h"
13 #include "components/user_manager/user.h" 15 #include "components/user_manager/user.h"
14 #include "components/user_manager/user_manager.h" 16 #include "components/user_manager/user_manager.h"
15 17
16 namespace arc { 18 namespace arc {
17 19
18 namespace { 20 namespace {
19 21
20 // Let IsAllowedForProfile() return "false" for any profile. 22 // Let IsAllowedForProfile() return "false" for any profile.
21 bool g_disallow_for_testing = false; 23 bool g_disallow_for_testing = false;
22 24
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return false; 91 return false;
90 } 92 }
91 93
92 return true; 94 return true;
93 } 95 }
94 96
95 void DisallowArcForTesting() { 97 void DisallowArcForTesting() {
96 g_disallow_for_testing = true; 98 g_disallow_for_testing = true;
97 } 99 }
98 100
101 bool IsArcPlayStoreEnabledForProfile(const Profile* profile) {
102 return IsArcAllowedForProfile(profile) &&
103 profile->GetPrefs()->GetBoolean(prefs::kArcEnabled);
104 }
105
106 bool IsArcPlayStoreEnabledPreferenceManagedForProfile(const Profile* profile) {
107 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 :-)
108 return profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled);
109 }
110
111 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) {
112 DCHECK(IsArcAllowedForProfile(profile));
113 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) {
114 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.
115 return;
116 }
117 profile->GetPrefs()->SetBoolean(prefs::kArcEnabled, enabled);
118 }
119
99 } // namespace arc 120 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698