| 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 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/ui/browser_commands.h" | 37 #include "chrome/browser/ui/browser_commands.h" |
| 38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 39 #include "chrome/grit/generated_resources.h" | 39 #include "chrome/grit/generated_resources.h" |
| 40 #include "chromeos/chromeos_switches.h" | 40 #include "chromeos/chromeos_switches.h" |
| 41 #include "chromeos/cryptohome/cryptohome_parameters.h" | 41 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 42 #include "chromeos/dbus/dbus_thread_manager.h" | 42 #include "chromeos/dbus/dbus_thread_manager.h" |
| 43 #include "chromeos/dbus/session_manager_client.h" | 43 #include "chromeos/dbus/session_manager_client.h" |
| 44 #include "components/arc/arc_bridge_service.h" | 44 #include "components/arc/arc_bridge_service.h" |
| 45 #include "components/arc/arc_session_runner.h" | 45 #include "components/arc/arc_session_runner.h" |
| 46 #include "components/arc/arc_util.h" | 46 #include "components/arc/arc_util.h" |
| 47 #include "components/policy/core/common/policy_pref_names.h" |
| 47 #include "components/pref_registry/pref_registry_syncable.h" | 48 #include "components/pref_registry/pref_registry_syncable.h" |
| 48 #include "components/prefs/pref_service.h" | 49 #include "components/prefs/pref_service.h" |
| 49 #include "components/sync_preferences/pref_service_syncable.h" | 50 #include "components/sync_preferences/pref_service_syncable.h" |
| 50 #include "content/public/browser/browser_thread.h" | 51 #include "content/public/browser/browser_thread.h" |
| 51 #include "extensions/browser/extension_prefs.h" | 52 #include "extensions/browser/extension_prefs.h" |
| 52 | 53 |
| 53 namespace arc { | 54 namespace arc { |
| 54 | 55 |
| 55 namespace { | 56 namespace { |
| 56 | 57 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 registry->RegisterBooleanPref(prefs::kArcDataRemoveRequested, false); | 107 registry->RegisterBooleanPref(prefs::kArcDataRemoveRequested, false); |
| 107 registry->RegisterBooleanPref(prefs::kArcEnabled, false); | 108 registry->RegisterBooleanPref(prefs::kArcEnabled, false); |
| 108 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); | 109 registry->RegisterBooleanPref(prefs::kArcSignedIn, false); |
| 109 registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false); | 110 registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false); |
| 110 // Note that ArcBackupRestoreEnabled and ArcLocationServiceEnabled prefs have | 111 // Note that ArcBackupRestoreEnabled and ArcLocationServiceEnabled prefs have |
| 111 // to be off by default, until an explicit gesture from the user to enable | 112 // 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 | 113 // them is received. This is crucial in the cases when these prefs transition |
| 113 // from a previous managed state to the unmanaged. | 114 // from a previous managed state to the unmanaged. |
| 114 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, false); | 115 registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, false); |
| 115 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, false); | 116 registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, false); |
| 117 // This is used to delete the Play user ID if ARC is disabled for an |
| 118 // AD-managed device. |
| 119 registry->RegisterStringPref(policy::policy_prefs::kActiveDirectoryPlayUserId, |
| 120 std::string()); |
| 116 } | 121 } |
| 117 | 122 |
| 118 // static | 123 // static |
| 119 bool ArcSessionManager::IsOobeOptInActive() { | 124 bool ArcSessionManager::IsOobeOptInActive() { |
| 120 // ARC OOBE OptIn is optional for now. Test if it exists and login host is | 125 // ARC OOBE OptIn is optional for now. Test if it exists and login host is |
| 121 // active. | 126 // active. |
| 122 if (!user_manager::UserManager::Get()->IsCurrentUserNew()) | 127 if (!user_manager::UserManager::Get()->IsCurrentUserNew()) |
| 123 return false; | 128 return false; |
| 124 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 129 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 125 chromeos::switches::kEnableArcOOBEOptIn)) | 130 chromeos::switches::kEnableArcOOBEOptIn)) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // OnArcDataRemoved resets this flag. | 184 // OnArcDataRemoved resets this flag. |
| 180 profile_->GetPrefs()->SetBoolean(prefs::kArcDataRemoveRequested, true); | 185 profile_->GetPrefs()->SetBoolean(prefs::kArcDataRemoveRequested, true); |
| 181 | 186 |
| 182 if (!arc_session_runner_->IsStopped()) { | 187 if (!arc_session_runner_->IsStopped()) { |
| 183 // Just set a flag. On session stopped, this will be re-called, | 188 // Just set a flag. On session stopped, this will be re-called, |
| 184 // then session manager should remove the data. | 189 // then session manager should remove the data. |
| 185 return; | 190 return; |
| 186 } | 191 } |
| 187 | 192 |
| 188 VLOG(1) << "Starting ARC data removal"; | 193 VLOG(1) << "Starting ARC data removal"; |
| 194 |
| 195 // Remove Play user ID for Active Directory managed devices. |
| 196 profile_->GetPrefs()->SetString( |
| 197 policy::policy_prefs::kActiveDirectoryPlayUserId, std::string()); |
| 198 |
| 189 SetState(State::REMOVING_DATA_DIR); | 199 SetState(State::REMOVING_DATA_DIR); |
| 190 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->RemoveArcData( | 200 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->RemoveArcData( |
| 191 cryptohome::Identification( | 201 cryptohome::Identification( |
| 192 multi_user_util::GetAccountIdFromProfile(profile_)), | 202 multi_user_util::GetAccountIdFromProfile(profile_)), |
| 193 base::Bind(&ArcSessionManager::OnArcDataRemoved, | 203 base::Bind(&ArcSessionManager::OnArcDataRemoved, |
| 194 weak_ptr_factory_.GetWeakPtr())); | 204 weak_ptr_factory_.GetWeakPtr())); |
| 195 } | 205 } |
| 196 | 206 |
| 197 void ArcSessionManager::OnArcDataRemoved(bool success) { | 207 void ArcSessionManager::OnArcDataRemoved(bool success) { |
| 198 if (success) | 208 if (success) |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 | 1010 |
| 1001 #undef MAP_STATE | 1011 #undef MAP_STATE |
| 1002 | 1012 |
| 1003 // Some compilers report an error even if all values of an enum-class are | 1013 // Some compilers report an error even if all values of an enum-class are |
| 1004 // covered exhaustively in a switch statement. | 1014 // covered exhaustively in a switch statement. |
| 1005 NOTREACHED() << "Invalid value " << static_cast<int>(state); | 1015 NOTREACHED() << "Invalid value " << static_cast<int>(state); |
| 1006 return os; | 1016 return os; |
| 1007 } | 1017 } |
| 1008 | 1018 |
| 1009 } // namespace arc | 1019 } // namespace arc |
| OLD | NEW |