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_
11 #include "ash/ash_export.h"
12 #include "base/callback.h"
13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string16.h"
20 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|,
21 // to access the cast extension.
22 class CastConfigDelegate
{
24 struct ASH_EXPORT Receiver
{
32 struct ASH_EXPORT Activity
{
33 // The tab identifier that we are casting. These are the special tab values
34 // taken from the chromecast extension itself. If an actual tab is being
35 // casted, then the TabId will be >= 0.
39 DISCOVERED_ACTIVITY
= -3,
40 EXTERNAL_EXTENSION_CLIENT
= -4
48 std::string activity_type
;
49 bool allow_stop
= false;
51 // The id for the tab we are casting. Could be one of the TabId values,
52 // or a value >= 0 that represents that tab index of the tab we are
53 // casting. We default to casting the desktop, as a tab may not
55 int tab_id
= TabId::DESKTOP
;
58 struct ASH_EXPORT ReceiverAndActivity
{
59 ReceiverAndActivity();
60 ~ReceiverAndActivity();
66 // The key is the receiver id.
67 using ReceiversAndActivites
= std::map
<std::string
, ReceiverAndActivity
>;
68 using ReceiversAndActivitesCallback
=
69 base::Callback
<void(const ReceiversAndActivites
&)>;
71 virtual ~CastConfigDelegate() {}
73 // Returns true if cast extension is installed.
74 virtual bool HasCastExtension() const = 0;
76 // Fetches the current set of receivers and their possible activities. This
77 // method will lookup the current chromecast extension and query its current
78 // state. The |callback| will be invoked when the receiver/activity data is
80 virtual void GetReceiversAndActivities(
81 const ReceiversAndActivitesCallback
& callback
) = 0;
83 // Cast to a receiver specified by |receiver_id|.
84 virtual void CastToReceiver(const std::string
& receiver_id
) = 0;
86 // Stop an ongoing cast.
87 virtual void StopCasting() = 0;
89 // Opens Options page for cast.
90 virtual void LaunchCastOptions() = 0;
93 DISALLOW_ASSIGN(CastConfigDelegate
);
98 #endif // ASH_CAST_CONFIG_DELEGATE_H_