| 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 "components/arc/user_data/arc_user_data_service.h" | 5 #include "components/arc/user_data/arc_user_data_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 8 #include "chromeos/chromeos_switches.h" |
| 7 #include "chromeos/cryptohome/cryptohome_parameters.h" | 9 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 8 #include "chromeos/dbus/dbus_thread_manager.h" | 10 #include "chromeos/dbus/dbus_thread_manager.h" |
| 9 #include "chromeos/dbus/session_manager_client.h" | 11 #include "chromeos/dbus/session_manager_client.h" |
| 10 #include "components/prefs/pref_member.h" | 12 #include "components/prefs/pref_member.h" |
| 11 #include "components/signin/core/account_id/account_id.h" | 13 #include "components/signin/core/account_id/account_id.h" |
| 12 #include "components/user_manager/user_manager.h" | 14 #include "components/user_manager/user_manager.h" |
| 13 | 15 |
| 14 namespace arc { | 16 namespace arc { |
| 15 | 17 |
| 16 ArcUserDataService::ArcUserDataService( | 18 ArcUserDataService::ArcUserDataService( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 42 } | 44 } |
| 43 ClearIfDisabled(); | 45 ClearIfDisabled(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void ArcUserDataService::ClearIfDisabled() { | 48 void ArcUserDataService::ClearIfDisabled() { |
| 47 DCHECK(thread_checker_.CalledOnValidThread()); | 49 DCHECK(thread_checker_.CalledOnValidThread()); |
| 48 if (arc_bridge_service()->state() != ArcBridgeService::State::STOPPED) { | 50 if (arc_bridge_service()->state() != ArcBridgeService::State::STOPPED) { |
| 49 LOG(ERROR) << "ARC instance not stopped, user data can't be cleared"; | 51 LOG(ERROR) << "ARC instance not stopped, user data can't be cleared"; |
| 50 return; | 52 return; |
| 51 } | 53 } |
| 52 if (arc_enabled_pref_->GetValue()) | 54 if (arc_enabled_pref_->GetValue() || |
| 55 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 56 chromeos::switches::kDisableArcDataWipe)) { |
| 53 return; | 57 return; |
| 58 } |
| 54 const cryptohome::Identification cryptohome_id(primary_user_account_id_); | 59 const cryptohome::Identification cryptohome_id(primary_user_account_id_); |
| 55 chromeos::SessionManagerClient* session_manager_client = | 60 chromeos::SessionManagerClient* session_manager_client = |
| 56 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); | 61 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
| 57 session_manager_client->RemoveArcData(cryptohome_id); | 62 session_manager_client->RemoveArcData(cryptohome_id); |
| 58 } | 63 } |
| 59 | 64 |
| 60 } // namespace arc | 65 } // namespace arc |
| OLD | NEW |