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

Side by Side Diff: chrome/browser/chromeos/arc/arc_util.cc

Issue 2755073003: [Merge M58] arc: Reactivate OptIn flow on clicking Play Store. (Closed)
Patch Set: update unit_tests expectation for M58 Created 3 years, 9 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/arc/arc_session_manager.h"
8 #include "chrome/browser/chromeos/login/user_flow.h" 9 #include "chrome/browser/chromeos/login/user_flow.h"
9 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 10 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" 11 #include "chrome/browser/chromeos/profiles/profile_helper.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
13 #include "components/arc/arc_util.h" 14 #include "components/arc/arc_util.h"
14 #include "components/prefs/pref_service.h" 15 #include "components/prefs/pref_service.h"
15 #include "components/user_manager/user.h" 16 #include "components/user_manager/user.h"
16 #include "components/user_manager/user_manager.h" 17 #include "components/user_manager/user_manager.h"
17 18
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (!IsArcAllowedForProfile(profile)) { 108 if (!IsArcAllowedForProfile(profile)) {
108 LOG(DFATAL) << "ARC is not allowed for profile"; 109 LOG(DFATAL) << "ARC is not allowed for profile";
109 return false; 110 return false;
110 } 111 }
111 return profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled); 112 return profile->GetPrefs()->IsManagedPreference(prefs::kArcEnabled);
112 } 113 }
113 114
114 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) { 115 void SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) {
115 DCHECK(IsArcAllowedForProfile(profile)); 116 DCHECK(IsArcAllowedForProfile(profile));
116 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) { 117 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) {
117 VLOG(1) << "Do nothing, since the Google-Play-Store-enabled pref is " 118 VLOG(1) << "Google-Play-Store-enabled pref is managed. Request to "
118 << "managed."; 119 << (enabled ? "enable" : "disable") << " Play Store is not stored";
120 // Need update ARC session manager manually for managed case in order to
121 // keep its state up to date, otherwise it may stuck with enabling
122 // request.
123 // TODO (khmel): Consider finding the better way handling this.
124 ArcSessionManager* arc_session_manager = ArcSessionManager::Get();
125 // |arc_session_manager| can be nullptr in unit_tests.
126 if (!arc_session_manager)
127 return;
128 if (enabled)
129 arc_session_manager->RequestEnable();
130 else
131 arc_session_manager->RequestDisable();
119 return; 132 return;
120 } 133 }
121 profile->GetPrefs()->SetBoolean(prefs::kArcEnabled, enabled); 134 profile->GetPrefs()->SetBoolean(prefs::kArcEnabled, enabled);
122 } 135 }
123 136
124 } // namespace arc 137 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager_unittest.cc ('k') | chrome/browser/ui/app_list/arc/arc_app_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698