Chromium Code Reviews| Index: components/arc/arc_service_manager.cc |
| diff --git a/components/arc/arc_service_manager.cc b/components/arc/arc_service_manager.cc |
| index df71eed57ca1da3ef8e6f3b3c0ed0bbcd83acbf4..0c1c9d7c7c00b0b65f90af0fc6848da1ab94cb26 100644 |
| --- a/components/arc/arc_service_manager.cc |
| +++ b/components/arc/arc_service_manager.cc |
| @@ -20,7 +20,10 @@ |
| #include "components/arc/net/arc_net_host_impl.h" |
| #include "components/arc/power/arc_power_bridge.h" |
| #include "components/arc/storage_manager/arc_storage_manager.h" |
| +#include "components/arc/user_data/arc_user_data_service.h" |
| #include "components/arc/window_manager/arc_window_manager_bridge.h" |
| +#include "components/prefs/pref_member.h" |
| +#include "components/prefs/pref_service.h" |
| #include "ui/arc/notification/arc_notification_manager.h" |
| namespace arc { |
| @@ -60,6 +63,8 @@ ArcServiceManager::ArcServiceManager( |
| AddService(base::WrapUnique(new ArcNetHostImpl(arc_bridge_service()))); |
| AddService(base::WrapUnique(new ArcPowerBridge(arc_bridge_service()))); |
| AddService(base::WrapUnique(new ArcStorageManager(arc_bridge_service()))); |
| + |
| + arc_user_data_service_.reset(new ArcUserDataService(this)); |
|
Luis Héctor Chávez
2016/05/20 15:03:58
nit: arc_user_data_service_ = base::MakeUnique<Arc
dspaid
2016/05/23 01:22:36
Done.
|
| } |
| ArcServiceManager::~ArcServiceManager() { |
| @@ -69,6 +74,8 @@ ArcServiceManager::~ArcServiceManager() { |
| if (g_arc_bridge_service_for_testing) { |
| delete g_arc_bridge_service_for_testing; |
| } |
| + if (arc_enabled_pref_) |
|
Daniel Erat
2016/05/20 17:41:05
it doesn't seem like you need this. PrefMemberBase
dspaid
2016/05/23 01:22:36
Done.
|
| + arc_enabled_pref_->Destroy(); |
| } |
| // static |
| @@ -90,13 +97,25 @@ void ArcServiceManager::AddService(std::unique_ptr<ArcService> service) { |
| } |
| void ArcServiceManager::OnPrimaryUserProfilePrepared( |
| - const AccountId& account_id) { |
| + const AccountId& account_id, |
| + PrefService* pref_service, |
| + std::string pref_name) { |
| + if (arc_enabled_pref_) |
|
Luis Héctor Chávez
2016/05/20 15:03:58
DCHECK(thread_checker_.CalledOnValidThread());
dspaid
2016/05/23 01:22:36
Done.
|
| + arc_enabled_pref_->Destroy(); |
|
Daniel Erat
2016/05/20 17:41:05
you shouldn't need this here either
dspaid
2016/05/23 01:22:36
Done.
|
| + arc_enabled_pref_ = std::unique_ptr<BooleanPrefMember>( |
|
Luis Héctor Chávez
2016/05/20 15:03:58
nit: arc_enabled_pref_ = base::MakeUnique<BooleanP
dspaid
2016/05/23 01:22:36
Acknowledged.
|
| + new BooleanPrefMember()); |
| + arc_enabled_pref_->Init(pref_name, pref_service); |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + arc_user_data_service_->ClearIfDisabled(account_id); |
| AddService(base::WrapUnique( |
| new ArcNotificationManager(arc_bridge_service(), account_id))); |
| } |
| +bool ArcServiceManager::IsArcEnabled() { |
| + return arc_enabled_pref_ && arc_enabled_pref_->GetValue(); |
|
Luis Héctor Chávez
2016/05/20 15:03:58
DCHECK(thread_checker_.CalledOnValidThread());
dspaid
2016/05/23 01:22:36
Done.
|
| +} |
| + |
| void ArcServiceManager::OnAshStarted() { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| // We might come here multiple times. As such we should only do this once. |