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

Side by Side Diff: ash/common/cast_config_delegate.h

Issue 2424183002: Remove Chromecast extension support from cast system tray menu. (Closed)
Patch Set: Initial patch Created 4 years, 1 month 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
« no previous file with comments | « no previous file | ash/common/cast_config_delegate.cc » ('j') | ash/common/system/cast/tray_cast.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_COMMON_CAST_CONFIG_DELEGATE_H_ 5 #ifndef ASH_COMMON_CAST_CONFIG_DELEGATE_H_
6 #define ASH_COMMON_CAST_CONFIG_DELEGATE_H_ 6 #define ASH_COMMON_CAST_CONFIG_DELEGATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/ash_export.h" 12 #include "ash/ash_export.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace ash { 17 namespace ash {
18 18
19 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|, 19 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|,
20 // to access the cast extension. 20 // to access the cast extension.
21 class CastConfigDelegate { 21 class CastConfigDelegate {
22 public: 22 public:
23 struct ASH_EXPORT Receiver { 23 struct ASH_EXPORT Sink {
24 Receiver(); 24 Sink();
25 ~Receiver(); 25 ~Sink();
26 26
27 std::string id; 27 std::string id;
28 base::string16 name; 28 base::string16 name;
29 base::string16 domain;
29 }; 30 };
30 31
31 struct ASH_EXPORT Activity { 32 struct ASH_EXPORT Route {
32 // The tab identifier that we are casting. These are the special tab values 33 enum class ContentSource { UNKNOWN, TAB, DESKTOP };
33 // taken from the chromecast extension itself. If an actual tab is being
34 // casted, then the TabId will be >= 0.
35 enum TabId {
36 EXTENSION = -1,
37 DESKTOP = -2,
38 DISCOVERED_ACTIVITY = -3,
39 EXTERNAL_EXTENSION_CLIENT = -4,
40 34
41 // Not in the extension. Used when the extension does not give us a tabId 35 Route();
42 // (ie, the cast is running from another device). 36 ~Route();
43 UNKNOWN = -5
44 };
45
46 Activity();
47 ~Activity();
48 37
49 std::string id; 38 std::string id;
50 base::string16 title; 39 base::string16 title;
51 40
52 // Is the activity source this computer? ie, are we mirroring the display? 41 // Is the activity originating from this computer?
53 bool is_local_source = false; 42 bool is_local_source = false;
54 43
55 // The id for the tab we are casting. Could be one of the TabId values, 44 // What is source of the content? For example, we could be DIAL casting a
56 // or a value >= 0 that represents that tab index of the tab we are 45 // tab or mirroring the entire desktop.
57 // casting. We default to casting the desktop, as a tab may not 46 ContentSource content_source = ContentSource::UNKNOWN;
58 // necessarily exist.
59 // TODO(jdufault): Remove tab_id once the CastConfigDelegateChromeos is
60 // gone. See crbug.com/551132.
61 int tab_id = TabId::DESKTOP;
62 }; 47 };
63 48
64 struct ASH_EXPORT ReceiverAndActivity { 49 struct ASH_EXPORT SinkAndRoute {
65 ReceiverAndActivity(); 50 SinkAndRoute();
66 ~ReceiverAndActivity(); 51 ~SinkAndRoute();
67 52
68 Receiver receiver; 53 Sink sink;
69 Activity activity; 54 Route route;
70 }; 55 };
71 56
72 using ReceiversAndActivities = std::vector<ReceiverAndActivity>; 57 using SinksAndRoutes = std::vector<SinkAndRoute>;
73 58
74 class ASH_EXPORT Observer { 59 class ASH_EXPORT Observer {
75 public: 60 public:
76 // Invoked whenever there is new receiver or activity information available. 61 // Invoked whenever there is new receiver or activity information available.
77 virtual void OnDevicesUpdated(const ReceiversAndActivities& devices) = 0; 62 virtual void OnDevicesUpdated(const SinksAndRoutes& devices) = 0;
78 63
79 protected: 64 protected:
80 virtual ~Observer() {} 65 virtual ~Observer() {}
81 66
82 private: 67 private:
83 DISALLOW_ASSIGN(Observer); 68 DISALLOW_ASSIGN(Observer);
84 }; 69 };
85 70
86 virtual ~CastConfigDelegate() {} 71 virtual ~CastConfigDelegate() {}
87 72
88 // Returns true if cast extension is installed.
89 // TODO(jdufault): Remove this function once the CastConfigDelegateChromeos is
90 // gone. See crbug.com/551132.
91 virtual bool HasCastExtension() const = 0;
92
93 // Request fresh data from the backend. When the data is available, all 73 // Request fresh data from the backend. When the data is available, all
94 // registered observers will get called. 74 // registered observers will get called.
95 virtual void RequestDeviceRefresh() = 0; 75 virtual void RequestDeviceRefresh() = 0;
96 76
97 // Cast to a receiver specified by |receiver_id|. 77 // Initiate a casting session to |sink|.
98 virtual void CastToReceiver(const std::string& receiver_id) = 0; 78 virtual void CastToReceiver(const Sink& sink) = 0;
achuithb 2016/10/27 19:38:59 Should this be CastToSink, or is this name still o
jdufault 2016/10/31 21:12:07 Done.
99 79
100 // Stop an ongoing cast (this should be a user initiated stop). |activity_id| 80 // A user-initiated request to stop the given cast session.
101 // is the identifier of the activity/route that should be stopped. 81 virtual void StopCasting(const Route& route) = 0;
102 virtual void StopCasting(const std::string& activity_id) = 0;
103
104 // Does the device have a settings page?
105 // TODO(jdufault): Remove this function once the CastConfigDelegateChromeos is
106 // gone. See crbug.com/551132.
107 virtual bool HasOptions() const = 0;
108
109 // Opens Options page for cast.
110 // TODO(jdufault): Remove this function once the CastConfigDelegateChromeos is
111 // gone. See crbug.com/551132.
112 virtual void LaunchCastOptions() = 0;
113 82
114 // Add or remove an observer. 83 // Add or remove an observer.
115 virtual void AddObserver(Observer* observer) = 0; 84 virtual void AddObserver(Observer* observer) = 0;
116 virtual void RemoveObserver(Observer* observer) = 0; 85 virtual void RemoveObserver(Observer* observer) = 0;
117 86
118 private: 87 private:
119 DISALLOW_ASSIGN(CastConfigDelegate); 88 DISALLOW_ASSIGN(CastConfigDelegate);
120 }; 89 };
121 90
122 } // namespace ash 91 } // namespace ash
123 92
124 #endif // ASH_COMMON_CAST_CONFIG_DELEGATE_H_ 93 #endif // ASH_COMMON_CAST_CONFIG_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | ash/common/cast_config_delegate.cc » ('j') | ash/common/system/cast/tray_cast.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698