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

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: Add TODO for proper fix 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
« no previous file with comments | « ash/cast_config_delegate.h ('k') | ash/system/cast/tray_cast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f3934cfd4f0fe6f3051107455706712a030ed60f 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;
@@ -47,14 +48,13 @@ class ASH_EXPORT TrayCast : public SystemTrayItem, public ShellObserver {
// Overridden from ShellObserver.
void OnCastingSessionStartedOrStopped(bool started) override;
+ // Overridden from CastConfigDelegate::Observer.
+ void OnDevicesUpdated(
+ const CastConfigDelegate::ReceiversAndActivities& devices) override;
+
// 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);
-
// 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
// view with a stop button is displayed; otherwise, a view that links to 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);
};
« no previous file with comments | « ash/cast_config_delegate.h ('k') | ash/system/cast/tray_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698