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

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

Issue 2704113003: Save Play user id when ARC user gets a Managed Google Play account (Closed)
Patch Set: Rebase 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_session_manager.h" 5 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/shelf/shelf_delegate.h" 9 #include "ash/common/shelf/shelf_delegate.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 registry->RegisterBooleanPref(prefs::kArcDataRemoveRequested, false); 101 registry->RegisterBooleanPref(prefs::kArcDataRemoveRequested, false);
102 registry->RegisterBooleanPref(prefs::kArcEnabled, false); 102 registry->RegisterBooleanPref(prefs::kArcEnabled, false);
103 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); 103 registry->RegisterBooleanPref(prefs::kArcSignedIn, false);
104 registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false); 104 registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false);
105 // Note that ArcBackupRestoreEnabled and ArcLocationServiceEnabled prefs have 105 // Note that ArcBackupRestoreEnabled and ArcLocationServiceEnabled prefs have
106 // to be off by default, until an explicit gesture from the user to enable 106 // to be off by default, until an explicit gesture from the user to enable
107 // them is received. This is crucial in the cases when these prefs transition 107 // them is received. This is crucial in the cases when these prefs transition
108 // from a previous managed state to the unmanaged. 108 // from a previous managed state to the unmanaged.
109 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, false); 109 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, false);
110 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, false); 110 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, false);
111 // This is used to delete the Play user ID if ARC is disabled for an
112 // AD-managed device.
113 registry->RegisterStringPref(prefs::kArcActiveDirectoryPlayUserId,
114 std::string());
111 } 115 }
112 116
113 // static 117 // static
114 bool ArcSessionManager::IsOobeOptInActive() { 118 bool ArcSessionManager::IsOobeOptInActive() {
115 // ARC OOBE OptIn is optional for now. Test if it exists and login host is 119 // ARC OOBE OptIn is optional for now. Test if it exists and login host is
116 // active. 120 // active.
117 if (!user_manager::UserManager::Get()->IsCurrentUserNew()) 121 if (!user_manager::UserManager::Get()->IsCurrentUserNew())
118 return false; 122 return false;
119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 123 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
120 chromeos::switches::kEnableArcOOBEOptIn)) 124 chromeos::switches::kEnableArcOOBEOptIn))
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // OnArcDataRemoved resets this flag. 178 // OnArcDataRemoved resets this flag.
175 profile_->GetPrefs()->SetBoolean(prefs::kArcDataRemoveRequested, true); 179 profile_->GetPrefs()->SetBoolean(prefs::kArcDataRemoveRequested, true);
176 180
177 if (!arc_session_runner_->IsStopped()) { 181 if (!arc_session_runner_->IsStopped()) {
178 // Just set a flag. On session stopped, this will be re-called, 182 // Just set a flag. On session stopped, this will be re-called,
179 // then session manager should remove the data. 183 // then session manager should remove the data.
180 return; 184 return;
181 } 185 }
182 186
183 VLOG(1) << "Starting ARC data removal"; 187 VLOG(1) << "Starting ARC data removal";
188
189 // Remove Play user ID for Active Directory managed devices.
190 profile_->GetPrefs()->SetString(prefs::kArcActiveDirectoryPlayUserId,
191 std::string());
192
184 SetState(State::REMOVING_DATA_DIR); 193 SetState(State::REMOVING_DATA_DIR);
185 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->RemoveArcData( 194 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->RemoveArcData(
186 cryptohome::Identification( 195 cryptohome::Identification(
187 multi_user_util::GetAccountIdFromProfile(profile_)), 196 multi_user_util::GetAccountIdFromProfile(profile_)),
188 base::Bind(&ArcSessionManager::OnArcDataRemoved, 197 base::Bind(&ArcSessionManager::OnArcDataRemoved,
189 weak_ptr_factory_.GetWeakPtr())); 198 weak_ptr_factory_.GetWeakPtr()));
190 } 199 }
191 200
192 void ArcSessionManager::OnArcDataRemoved(bool success) { 201 void ArcSessionManager::OnArcDataRemoved(bool success) {
193 if (success) 202 if (success)
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 910
902 #undef MAP_STATE 911 #undef MAP_STATE
903 912
904 // Some compilers report an error even if all values of an enum-class are 913 // Some compilers report an error even if all values of an enum-class are
905 // covered exhaustively in a switch statement. 914 // covered exhaustively in a switch statement.
906 NOTREACHED() << "Invalid value " << static_cast<int>(state); 915 NOTREACHED() << "Invalid value " << static_cast<int>(state);
907 return os; 916 return os;
908 } 917 }
909 918
910 } // namespace arc 919 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698