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

Unified Diff: ash/cast_config_delegate.h

Issue 1288073005: Make the ChromeOS chromecast system tray integration use a private API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 5 years, 4 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 | « no previous file | ash/system/cast/tray_cast.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/cast_config_delegate.h
diff --git a/ash/cast_config_delegate.h b/ash/cast_config_delegate.h
index f38a05c5f3f6322ad00a77f7b24d61a6916f6fbb..8fd73889a53e298ad195ae374de3f9d87dff35ba 100644
--- a/ash/cast_config_delegate.h
+++ b/ash/cast_config_delegate.h
@@ -5,11 +5,12 @@
#ifndef ASH_CAST_CONFIG_DELEGATE_H_
#define ASH_CAST_CONFIG_DELEGATE_H_
-#include <map>
#include <string>
+#include <vector>
#include "ash/ash_export.h"
#include "base/callback.h"
+#include "base/callback_list.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
@@ -37,7 +38,11 @@ class CastConfigDelegate {
EXTENSION = -1,
DESKTOP = -2,
DISCOVERED_ACTIVITY = -3,
- EXTERNAL_EXTENSION_CLIENT = -4
+ EXTERNAL_EXTENSION_CLIENT = -4,
+
+ // Not in the extension. Used when the extension does not give us a tabId
+ // (ie, the cast is running from another device).
+ UNKNOWN = -5
};
Activity();
@@ -45,8 +50,6 @@ class CastConfigDelegate {
std::string id;
base::string16 title;
- std::string activity_type;
- bool allow_stop = false;
// The id for the tab we are casting. Could be one of the TabId values,
// or a value >= 0 that represents that tab index of the tab we are
@@ -64,26 +67,30 @@ class CastConfigDelegate {
};
// The key is the receiver id.
- using ReceiversAndActivites = std::map<std::string, ReceiverAndActivity>;
+ using ReceiversAndActivites = std::vector<ReceiverAndActivity>;
using ReceiversAndActivitesCallback =
base::Callback<void(const ReceiversAndActivites&)>;
+ using DeviceUpdateSubscription = scoped_ptr<
+ base::CallbackList<void(const ReceiversAndActivites&)>::Subscription>;
virtual ~CastConfigDelegate() {}
// Returns true if cast extension is installed.
virtual bool HasCastExtension() const = 0;
- // Fetches the current set of receivers and their possible activities. This
- // method will lookup the current chromecast extension and query its current
- // state. The |callback| will be invoked when the receiver/activity data is
- // available.
- virtual void GetReceiversAndActivities(
+ // Adds a listener that will get invoked whenever the receivers or their
+ // associated activites have changed.
+ virtual DeviceUpdateSubscription RegisterDeviceUpdateObserver(
const ReceiversAndActivitesCallback& callback) = 0;
+ // Request fresh data from the backend. When the data is available, all
+ // registered observers will get called.
+ virtual void RequestDeviceRefresh() = 0;
+
// Cast to a receiver specified by |receiver_id|.
virtual void CastToReceiver(const std::string& receiver_id) = 0;
- // Stop an ongoing cast.
+ // Stop an ongoing cast (this should be a user initiated stop).
virtual void StopCasting() = 0;
// Opens Options page for cast.
« no previous file with comments | « no previous file | ash/system/cast/tray_cast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698