OLD | NEW |
---|---|
(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 struct ASH_EXPORT Activity { | |
32 enum TabId { | |
achuithb
2015/05/06 00:45:57
Please provide an explanation of how these values
jdufault
2015/05/06 19:02:55
Done.
| |
33 EXTENSION = -1, | |
34 DESKTOP = -2, | |
35 DISCOVERED_ACTIVITY = -3, | |
36 EXTERNAL_EXTENSION_CLIENT = -4 | |
37 }; | |
38 | |
39 Activity(); | |
40 ~Activity(); | |
41 | |
42 std::string id; | |
43 base::string16 title; | |
44 std::string activity_type; | |
45 bool allow_stop = false; | |
46 | |
47 // The id for the tab we are casting. Could be one of the TabId values.:w | |
achuithb
2015/05/06 00:45:57
Remove :w
jdufault
2015/05/06 19:02:55
Done.
| |
48 int tab_id; | |
achuithb
2015/05/06 00:45:57
should this have a default value?
jdufault
2015/05/06 19:02:55
Done.
| |
49 }; | |
50 struct ASH_EXPORT ReceiverAndActivity { | |
51 ReceiverAndActivity(); | |
52 ~ReceiverAndActivity(); | |
53 | |
54 Receiver receiver; | |
55 Activity activity; | |
56 }; | |
57 using ReceiversAndActivites = std::map<std::string, ReceiverAndActivity>; | |
58 using ReceiversAndActivitesCallback = | |
59 base::Callback<void(const ReceiversAndActivites&)>; | |
60 | |
61 virtual ~CastConfigDelegate() {} | |
achuithb
2015/05/06 00:45:57
Let's move the implementation to the .cc as well
jdufault
2015/05/06 19:02:55
Done.
| |
62 | |
63 // Returns true if cast extension is installed. | |
64 virtual bool HasCastExtension() = 0; | |
65 // Returns the list of cast receivers and activities. | |
66 virtual void GetReceiversAndActivities( | |
67 const ReceiversAndActivitesCallback& callback) = 0; | |
68 // Cast to a device. | |
69 virtual void CastToReceiver(const std::string& receiver_id) = 0; | |
70 // Stop ongoing cast. | |
71 virtual void StopCasting(const std::string& activity_id) = 0; | |
72 // Opens Options page for cast. | |
73 virtual void LaunchCastOptions() = 0; | |
74 | |
75 private: | |
76 DISALLOW_ASSIGN(CastConfigDelegate); | |
77 }; | |
78 | |
79 } // namespace ash | |
80 | |
81 #endif // ASH_CAST_CONFIG_DELEGATE_H_ | |
OLD | NEW |