Make app list recommendations ignore KnownResults.
[chromium-blink-merge.git] / ash / cast_config_delegate.h
blob8fd73889a53e298ad195ae374de3f9d87dff35ba
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
3 // found in the LICENSE file.
5 #ifndef ASH_CAST_CONFIG_DELEGATE_H_
6 #define ASH_CAST_CONFIG_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "ash/ash_export.h"
12 #include "base/callback.h"
13 #include "base/callback_list.h"
14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string16.h"
17 #include "url/gurl.h"
19 namespace ash {
21 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|,
22 // to access the cast extension.
23 class CastConfigDelegate {
24 public:
25 struct ASH_EXPORT Receiver {
26 Receiver();
27 ~Receiver();
29 std::string id;
30 base::string16 name;
33 struct ASH_EXPORT Activity {
34 // The tab identifier that we are casting. These are the special tab values
35 // taken from the chromecast extension itself. If an actual tab is being
36 // casted, then the TabId will be >= 0.
37 enum TabId {
38 EXTENSION = -1,
39 DESKTOP = -2,
40 DISCOVERED_ACTIVITY = -3,
41 EXTERNAL_EXTENSION_CLIENT = -4,
43 // Not in the extension. Used when the extension does not give us a tabId
44 // (ie, the cast is running from another device).
45 UNKNOWN = -5
48 Activity();
49 ~Activity();
51 std::string id;
52 base::string16 title;
54 // The id for the tab we are casting. Could be one of the TabId values,
55 // or a value >= 0 that represents that tab index of the tab we are
56 // casting. We default to casting the desktop, as a tab may not
57 // necessarily exist.
58 int tab_id = TabId::DESKTOP;
61 struct ASH_EXPORT ReceiverAndActivity {
62 ReceiverAndActivity();
63 ~ReceiverAndActivity();
65 Receiver receiver;
66 Activity activity;
69 // The key is the receiver id.
70 using ReceiversAndActivites = std::vector<ReceiverAndActivity>;
71 using ReceiversAndActivitesCallback =
72 base::Callback<void(const ReceiversAndActivites&)>;
73 using DeviceUpdateSubscription = scoped_ptr<
74 base::CallbackList<void(const ReceiversAndActivites&)>::Subscription>;
76 virtual ~CastConfigDelegate() {}
78 // Returns true if cast extension is installed.
79 virtual bool HasCastExtension() const = 0;
81 // Adds a listener that will get invoked whenever the receivers or their
82 // associated activites have changed.
83 virtual DeviceUpdateSubscription RegisterDeviceUpdateObserver(
84 const ReceiversAndActivitesCallback& callback) = 0;
86 // Request fresh data from the backend. When the data is available, all
87 // registered observers will get called.
88 virtual void RequestDeviceRefresh() = 0;
90 // Cast to a receiver specified by |receiver_id|.
91 virtual void CastToReceiver(const std::string& receiver_id) = 0;
93 // Stop an ongoing cast (this should be a user initiated stop).
94 virtual void StopCasting() = 0;
96 // Opens Options page for cast.
97 virtual void LaunchCastOptions() = 0;
99 private:
100 DISALLOW_ASSIGN(CastConfigDelegate);
103 } // namespace ash
105 #endif // ASH_CAST_CONFIG_DELEGATE_H_