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

Unified Diff: ash/system/cast/tray_cast.h

Issue 1567103005: Replace base::CallbackList with base::ObserverList in CastConfigDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Replace with ObserverList instead of base::Callback Created 4 years, 11 months 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
Index: ash/system/cast/tray_cast.h
diff --git a/ash/system/cast/tray_cast.h b/ash/system/cast/tray_cast.h
index a14877702bb068011aea6e6a9a0344bde1d931a5..2137fc0f05fc9ad6eb8a20d607ff07ddec2b7014 100644
--- a/ash/system/cast/tray_cast.h
+++ b/ash/system/cast/tray_cast.h
@@ -9,7 +9,6 @@
#include "ash/shell_observer.h"
#include "ash/system/tray/system_tray_item.h"
#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
namespace ash {
namespace tray {
@@ -19,7 +18,9 @@ class CastDetailedView;
class CastDuplexView;
} // namespace tray
-class ASH_EXPORT TrayCast : public SystemTrayItem, public ShellObserver {
+class ASH_EXPORT TrayCast : public SystemTrayItem,
+ public ShellObserver,
+ public CastConfigDelegate::Observer {
public:
explicit TrayCast(SystemTray* system_tray);
~TrayCast() override;
@@ -50,10 +51,9 @@ class ASH_EXPORT TrayCast : public SystemTrayItem, public ShellObserver {
// Returns true if the cast extension was detected.
bool HasCastExtension();
- // Callback used to enable/disable the begin casting view depending on
- // if we have any cast receivers.
- void OnReceiversUpdated(
- const CastConfigDelegate::ReceiversAndActivities& receivers_activities);
+ // Overridden from CastConfigDelegate::Observer.
+ void OnDevicesUpdated(
+ const CastConfigDelegate::ReceiversAndActivities& devices) override;
// This makes sure that the current view displayed in the tray is the correct
// one, depending on if we are currently casting. If we're casting, then a
@@ -63,16 +63,15 @@ class ASH_EXPORT TrayCast : public SystemTrayItem, public ShellObserver {
void UpdatePrimaryView();
CastConfigDelegate::ReceiversAndActivities receivers_and_activities_;
- CastConfigDelegate::DeviceUpdateSubscription device_update_subscription_;
bool is_casting_ = false;
+ bool added_observer_ = false;
+
// Not owned.
tray::CastTrayView* tray_ = nullptr;
tray::CastDuplexView* default_ = nullptr;
tray::CastDetailedView* detailed_ = nullptr;
- base::WeakPtrFactory<TrayCast> weak_ptr_factory_;
-
DISALLOW_COPY_AND_ASSIGN(TrayCast);
};

Powered by Google App Engine
This is Rietveld 408576698