Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2502243002: Support multiple Observer instances for ArcSupportHost. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_support_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_auth_service.h" 5 #include "chrome/browser/chromeos/arc/arc_auth_service.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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // ARC support Chrome app is rarely used (only opt-in and re-auth flow). 601 // ARC support Chrome app is rarely used (only opt-in and re-auth flow).
602 // So, it may be better to initialize it lazily. 602 // So, it may be better to initialize it lazily.
603 // TODO(hidehiko): Revisit to think about lazy initialization. 603 // TODO(hidehiko): Revisit to think about lazy initialization.
604 // 604 //
605 // Don't show UI for ARC Kiosk because the only one UI in kiosk mode must 605 // Don't show UI for ARC Kiosk because the only one UI in kiosk mode must
606 // be the kiosk app. In case of error the UI will be useless as well, because 606 // be the kiosk app. In case of error the UI will be useless as well, because
607 // in typical use case there will be no one nearby the kiosk device, who can 607 // in typical use case there will be no one nearby the kiosk device, who can
608 // do some action to solve the problem be means of UI. 608 // do some action to solve the problem be means of UI.
609 if (!g_disable_ui_for_testing && !IsOptInVerificationDisabled() && 609 if (!g_disable_ui_for_testing && !IsOptInVerificationDisabled() &&
610 !IsArcKioskMode()) { 610 !IsArcKioskMode()) {
611 DCHECK(!support_host_);
611 support_host_ = base::MakeUnique<ArcSupportHost>(profile_); 612 support_host_ = base::MakeUnique<ArcSupportHost>(profile_);
612 support_host_->AddObserver(this); 613 support_host_->AddObserver(this);
613 614
614 preference_handler_ = base::MakeUnique<arc::ArcOptInPreferenceHandler>( 615 preference_handler_ = base::MakeUnique<arc::ArcOptInPreferenceHandler>(
615 this, profile_->GetPrefs()); 616 this, profile_->GetPrefs());
616 // This automatically updates all preferences. 617 // This automatically updates all preferences.
617 preference_handler_->Start(); 618 preference_handler_->Start();
618 } 619 }
619 620
620 DCHECK_EQ(State::NOT_INITIALIZED, state_); 621 DCHECK_EQ(State::NOT_INITIALIZED, state_);
(...skipping 28 matching lines...) Expand all
649 return; 650 return;
650 651
651 pref_service_syncable->RemoveObserver(this); 652 pref_service_syncable->RemoveObserver(this);
652 653
653 if (IsArcEnabled()) 654 if (IsArcEnabled())
654 OnOptInPreferenceChanged(); 655 OnOptInPreferenceChanged();
655 } 656 }
656 657
657 void ArcAuthService::Shutdown() { 658 void ArcAuthService::Shutdown() {
658 ShutdownBridge(); 659 ShutdownBridge();
659 if (support_host_) 660 if (support_host_) {
660 support_host_->Close(); 661 support_host_->Close();
662 support_host_->RemoveObserver(this);
663 support_host_.reset();
664 }
661 if (profile_) { 665 if (profile_) {
662 sync_preferences::PrefServiceSyncable* pref_service_syncable = 666 sync_preferences::PrefServiceSyncable* pref_service_syncable =
663 PrefServiceSyncableFromProfile(profile_); 667 PrefServiceSyncableFromProfile(profile_);
664 pref_service_syncable->RemoveObserver(this); 668 pref_service_syncable->RemoveObserver(this);
665 pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this); 669 pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this);
666 } 670 }
667 pref_change_registrar_.RemoveAll(); 671 pref_change_registrar_.RemoveAll();
668 context_.reset(); 672 context_.reset();
669 profile_ = nullptr; 673 profile_ = nullptr;
670 arc_robot_auth_.reset(); 674 arc_robot_auth_.reset();
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 return os << "ACTIVE"; 1074 return os << "ACTIVE";
1071 } 1075 }
1072 1076
1073 // Some compiler reports an error even if all values of an enum-class are 1077 // Some compiler reports an error even if all values of an enum-class are
1074 // covered indivisually in a switch statement. 1078 // covered indivisually in a switch statement.
1075 NOTREACHED(); 1079 NOTREACHED();
1076 return os; 1080 return os;
1077 } 1081 }
1078 1082
1079 } // namespace arc 1083 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_support_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698