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 "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 Loading... | |
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)); | |
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) << "Whether Google Play Store is enabled is managed. Do nothing."; | |
xiyuan
2017/02/17 17:45:40
nit: Whether Google Play Store is enabled is manag
hidehiko
2017/02/20 18:18:44
Done.
| |
115 return; | |
116 } | |
117 profile->GetPrefs()->SetBoolean(prefs::kArcEnabled, enabled); | |
118 } | |
119 | |
99 } // namespace arc | 120 } // namespace arc |
OLD | NEW |