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

Side by Side Diff: ash/cast_config_delegate.h

Issue 1115083002: Add the supporting code for the cast system tray integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build for unit tests Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef ASH_CAST_CONFIG_DELEGATE_H_
6 #define ASH_CAST_CONFIG_DELEGATE_H_
7
8 #include <map>
9 #include <string>
10
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"
16 #include "url/gurl.h"
17
18 namespace ash {
19
20 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|,
21 // to access the cast extension.
22 class CastConfigDelegate {
23 public:
24 struct ASH_EXPORT Receiver {
25 Receiver();
26 ~Receiver();
27
28 std::string id;
29 base::string16 name;
30 };
31
32 struct ASH_EXPORT Activity {
oshima 2015/05/14 23:05:29 ASH_EXPORT struct is more common, although you may
jdufault 2015/05/15 23:02:25 This causes a compiler error.
oshima 2015/05/15 23:32:55 sorry, I thought I removed this comment. you're ri
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.
36 enum TabId {
37 EXTENSION = -1,
38 DESKTOP = -2,
39 DISCOVERED_ACTIVITY = -3,
40 EXTERNAL_EXTENSION_CLIENT = -4
41 };
42
43 Activity();
44 ~Activity();
45
46 std::string id;
47 base::string16 title;
48 std::string activity_type;
49 bool allow_stop = false;
50
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
54 // necessarily exist.
55 int tab_id = TabId::DESKTOP;
56 };
57
58 struct ASH_EXPORT ReceiverAndActivity {
59 ReceiverAndActivity();
60 ~ReceiverAndActivity();
61
62 Receiver receiver;
63 Activity activity;
64 };
65 // The key is the receiver id.
66 using ReceiversAndActivites = std::map<std::string, ReceiverAndActivity>;
67 using ReceiversAndActivitesCallback =
68 base::Callback<void(const ReceiversAndActivites&)>;
69
70 virtual ~CastConfigDelegate() {}
71
72 // Returns true if cast extension is installed.
73 virtual bool HasCastExtension() = 0;
oshima 2015/05/14 23:05:29 can this be const?
oshima 2015/05/14 23:05:29 new line between previous method and comment. same
jdufault 2015/05/15 23:02:25 Done.
jdufault 2015/05/15 23:02:25 Done.
74 // Fetches the current set of receivers and their possible activities. This
75 // method will lookup the current chromecast extension and query its current
76 // state. The |callback| will be invoked when the receiver/activity data is
77 // available.
78 virtual void GetReceiversAndActivities(
79 const ReceiversAndActivitesCallback& callback) = 0;
80 // Cast to a receiver specified by |receiver_id|.
81 virtual void CastToReceiver(const std::string& receiver_id) = 0;
82 // Stop ongoing cast. The |activity_id| is the unique identifier associated
83 // with the ongoing cast. Each receiver has only one possible activity
84 // associated with it. The |activity_id| is available by invoking
85 // GetReceiversAndActivities(); if the receiver is currently casting, then the
86 // associated activity data will have an id. This id can be used to stop the
87 // cast in this method.
88 virtual void StopCasting(const std::string& activity_id) = 0;
89 // Opens Options page for cast.
90 virtual void LaunchCastOptions() = 0;
91
92 private:
93 DISALLOW_ASSIGN(CastConfigDelegate);
94 };
95
96 } // namespace ash
97
98 #endif // ASH_CAST_CONFIG_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698