Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 registry->RegisterBooleanPref(prefs::kArcDataRemoveRequested, false); | 106 registry->RegisterBooleanPref(prefs::kArcDataRemoveRequested, false); |
| 107 registry->RegisterBooleanPref(prefs::kArcEnabled, false); | 107 registry->RegisterBooleanPref(prefs::kArcEnabled, false); |
| 108 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); | 108 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); |
| 109 registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false); | 109 registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false); |
| 110 // Note that ArcBackupRestoreEnabled and ArcLocationServiceEnabled prefs have | 110 // Note that ArcBackupRestoreEnabled and ArcLocationServiceEnabled prefs have |
| 111 // to be off by default, until an explicit gesture from the user to enable | 111 // to be off by default, until an explicit gesture from the user to enable |
| 112 // them is received. This is crucial in the cases when these prefs transition | 112 // them is received. This is crucial in the cases when these prefs transition |
| 113 // from a previous managed state to the unmanaged. | 113 // from a previous managed state to the unmanaged. |
| 114 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, false); | 114 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, false); |
| 115 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, false); | 115 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, false); |
| 116 // This is used to delete the Play user ID if ARC is disabled for an | |
| 117 // AD-managed device. | |
| 118 registry->RegisterStringPref(prefs::kArcActiveDirectoryPlayUserId, | |
| 119 std::string()); | |
|
achuithb
2017/03/02 14:41:01
nit: "" is more concise
| |
| 116 } | 120 } |
| 117 | 121 |
| 118 // static | 122 // static |
| 119 bool ArcSessionManager::IsOobeOptInActive() { | 123 bool ArcSessionManager::IsOobeOptInActive() { |
| 120 // ARC OOBE OptIn is optional for now. Test if it exists and login host is | 124 // ARC OOBE OptIn is optional for now. Test if it exists and login host is |
| 121 // active. | 125 // active. |
| 122 if (!user_manager::UserManager::Get()->IsCurrentUserNew()) | 126 if (!user_manager::UserManager::Get()->IsCurrentUserNew()) |
| 123 return false; | 127 return false; |
| 124 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 128 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 125 chromeos::switches::kEnableArcOOBEOptIn)) | 129 chromeos::switches::kEnableArcOOBEOptIn)) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 // OnArcDataRemoved resets this flag. | 183 // OnArcDataRemoved resets this flag. |
| 180 profile_->GetPrefs()->SetBoolean(prefs::kArcDataRemoveRequested, true); | 184 profile_->GetPrefs()->SetBoolean(prefs::kArcDataRemoveRequested, true); |
| 181 | 185 |
| 182 if (!arc_session_runner_->IsStopped()) { | 186 if (!arc_session_runner_->IsStopped()) { |
| 183 // Just set a flag. On session stopped, this will be re-called, | 187 // Just set a flag. On session stopped, this will be re-called, |
| 184 // then session manager should remove the data. | 188 // then session manager should remove the data. |
| 185 return; | 189 return; |
| 186 } | 190 } |
| 187 | 191 |
| 188 VLOG(1) << "Starting ARC data removal"; | 192 VLOG(1) << "Starting ARC data removal"; |
| 193 | |
| 194 // Remove Play user ID for Active Directory managed devices. | |
| 195 profile_->GetPrefs()->SetString(prefs::kArcActiveDirectoryPlayUserId, | |
| 196 std::string()); | |
| 197 | |
| 189 SetState(State::REMOVING_DATA_DIR); | 198 SetState(State::REMOVING_DATA_DIR); |
| 190 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->RemoveArcData( | 199 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->RemoveArcData( |
| 191 cryptohome::Identification( | 200 cryptohome::Identification( |
| 192 multi_user_util::GetAccountIdFromProfile(profile_)), | 201 multi_user_util::GetAccountIdFromProfile(profile_)), |
| 193 base::Bind(&ArcSessionManager::OnArcDataRemoved, | 202 base::Bind(&ArcSessionManager::OnArcDataRemoved, |
| 194 weak_ptr_factory_.GetWeakPtr())); | 203 weak_ptr_factory_.GetWeakPtr())); |
| 195 } | 204 } |
| 196 | 205 |
| 197 void ArcSessionManager::OnArcDataRemoved(bool success) { | 206 void ArcSessionManager::OnArcDataRemoved(bool success) { |
| 198 if (success) | 207 if (success) |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 | 1009 |
| 1001 #undef MAP_STATE | 1010 #undef MAP_STATE |
| 1002 | 1011 |
| 1003 // Some compilers report an error even if all values of an enum-class are | 1012 // Some compilers report an error even if all values of an enum-class are |
| 1004 // covered exhaustively in a switch statement. | 1013 // covered exhaustively in a switch statement. |
| 1005 NOTREACHED() << "Invalid value " << static_cast<int>(state); | 1014 NOTREACHED() << "Invalid value " << static_cast<int>(state); |
| 1006 return os; | 1015 return os; |
| 1007 } | 1016 } |
| 1008 | 1017 |
| 1009 } // namespace arc | 1018 } // namespace arc |
| OLD | NEW |