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

Unified Diff: chrome/browser/chromeos/arc/arc_support_host.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.cc ('k') | chrome/browser/chromeos/arc/arc_support_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_support_host.h
diff --git a/chrome/browser/chromeos/arc/arc_support_host.h b/chrome/browser/chromeos/arc/arc_support_host.h
index 9871f5ee7cd890407c4cae34340a3cb229e15023..1712611a7d89d03f5cbfc1649ac794adc441ae76 100644
--- a/chrome/browser/chromeos/arc/arc_support_host.h
+++ b/chrome/browser/chromeos/arc/arc_support_host.h
@@ -6,8 +6,10 @@
#define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_
#include <memory>
+#include <string>
#include "base/macros.h"
+#include "base/observer_list.h"
#include "chrome/browser/chromeos/arc/extensions/arc_support_message_host.h"
#include "extensions/browser/api/messaging/native_message_host.h"
#include "ui/display/display_observer.h"
@@ -46,23 +48,23 @@ class ArcSupportHost : public arc::ArcSupportMessageHost::Observer,
virtual ~Observer() = default;
// Called when the ARC support window is closed.
- virtual void OnWindowClosed() = 0;
+ virtual void OnWindowClosed() {}
// Called when the user press AGREE button on ToS page.
// TODO(hidehiko): Currently, due to implementation reason,
// this is also called when RETRY on error page is clicked. Fix this.
virtual void OnTermsAgreed(bool is_metrics_enabled,
bool is_backup_and_restore_enabled,
- bool is_location_service_enabled) = 0;
+ bool is_location_service_enabled) {}
// Called when LSO auth token fetch is successfully completed.
- virtual void OnAuthSucceeded(const std::string& auth_code) = 0;
+ virtual void OnAuthSucceeded(const std::string& auth_code) {}
// Called when "RETRY" button on the error page is clicked.
- virtual void OnRetryClicked() = 0;
+ virtual void OnRetryClicked() {}
// Called when send feedback button on error page is clicked.
- virtual void OnSendFeedbackClicked() = 0;
+ virtual void OnSendFeedbackClicked() {}
};
static const char kHostAppId[];
@@ -71,9 +73,9 @@ class ArcSupportHost : public arc::ArcSupportMessageHost::Observer,
explicit ArcSupportHost(Profile* profile);
~ArcSupportHost() override;
- // Currently only one observer can be added.
- // TODO(hidehiko): Support RemoveObserver. Support multiple observer.
void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+ bool HasObserver(Observer* observer);
// Called when the communication to arc_support Chrome App is ready.
void SetMessageHost(arc::ArcSupportMessageHost* message_host);
@@ -154,9 +156,7 @@ class ArcSupportHost : public arc::ArcSupportMessageHost::Observer,
Profile* const profile_;
- // Currently Observer is only ArcAuthService, so it is unique.
- // Use ObserverList when more classes start to observe it.
- Observer* observer_ = nullptr;
+ base::ObserverList<Observer> observer_list_;
// True, if ARC support app is requested to start, but the connection is not
// yet established. Reset to false, when the app is started and the
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.cc ('k') | chrome/browser/chromeos/arc/arc_support_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698