Chromium Code Reviews| Index: chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| index 78512a0c0193e24f2dd0c8aa44b01fcd69cc693d..39b31a5e607ee6762de99310c58927c01e314ba6 100644 |
| --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc |
| @@ -268,16 +268,23 @@ void ArcAppListPrefs::StartPrefs() { |
| arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); |
| CHECK(arc_session_manager); |
| - if (arc_session_manager->profile()) { |
| - // Note: If ArcSessionManager has profile, it should be as same as the one |
| - // this instance has, because ArcAppListPrefsFactory creates an instance |
| - // only if the given Profile meets ARC's requirement. |
| - // Anyway, just in case, check it here. |
| - DCHECK_EQ(profile_, arc_session_manager->profile()); |
| + // In sync test, ArcAppListPrefs with non primary profile will be created |
| + // after ArcSessionManager is initialized. Don't call |
| + // OnArcPlayStoreEnabledChanged() which may protentially confuse |
| + // ArcSessionManager state machine. |
| + if (arc_session_manager->profile() && |
|
hidehiko
2017/03/02 17:45:39
Hmm... I still do not want to remove the DCHECK ot
lgcheng
2017/03/02 23:45:10
Agree with you concern. Reconstruct a little.
Use
|
| + arc_session_manager->profile() == profile_) { |
| OnArcPlayStoreEnabledChanged( |
| arc::IsArcPlayStoreEnabledForProfile(profile_)); |
| } |
| - arc_session_manager->AddObserver(this); |
| + |
| + // In sync test, ArcAppListPrefs with non primary profile will be created |
| + // after ArcSessionManager is initialized. Don't tied ArcAppListPrefs created |
| + // with non primary profile to ArcSessionManager to avoid confusing |
| + // ArcSessionManager state machine. |
| + if (!arc_session_manager->profile() || |
| + arc_session_manager->profile() == profile_) |
| + arc_session_manager->AddObserver(this); |
| app_instance_holder_->AddObserver(this); |
| if (!app_instance_holder_->has_instance()) |