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

Side by Side Diff: ash/cast_config_delegate.h

Issue 2109613005: mash: Move system tray cast code into //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward decl Created 4 years, 5 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
« no previous file with comments | « ash/ash.gyp ('k') | ash/cast_config_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory>
9 #include <string>
10 #include <vector>
11
12 #include "ash/ash_export.h"
13 #include "base/macros.h"
14 #include "base/strings/string16.h"
15 #include "url/gurl.h"
16
17 namespace ash {
18
19 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|,
20 // to access the cast extension.
21 class CastConfigDelegate {
22 public:
23 struct ASH_EXPORT Receiver {
24 Receiver();
25 ~Receiver();
26
27 std::string id;
28 base::string16 name;
29 };
30
31 struct ASH_EXPORT Activity {
32 // The tab identifier that we are casting. These are the special tab values
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
41 // Not in the extension. Used when the extension does not give us a tabId
42 // (ie, the cast is running from another device).
43 UNKNOWN = -5
44 };
45
46 Activity();
47 ~Activity();
48
49 std::string id;
50 base::string16 title;
51
52 // Is the activity source this computer? ie, are we mirroring the display?
53 bool is_local_source = false;
54
55 // The id for the tab we are casting. Could be one of the TabId values,
56 // or a value >= 0 that represents that tab index of the tab we are
57 // casting. We default to casting the desktop, as a tab may not
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 };
63
64 struct ASH_EXPORT ReceiverAndActivity {
65 ReceiverAndActivity();
66 ~ReceiverAndActivity();
67
68 Receiver receiver;
69 Activity activity;
70 };
71
72 using ReceiversAndActivities = std::vector<ReceiverAndActivity>;
73
74 class ASH_EXPORT Observer {
75 public:
76 // Invoked whenever there is new receiver or activity information available.
77 virtual void OnDevicesUpdated(const ReceiversAndActivities& devices) = 0;
78
79 protected:
80 virtual ~Observer() {}
81
82 private:
83 DISALLOW_ASSIGN(Observer);
84 };
85
86 virtual ~CastConfigDelegate() {}
87
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
94 // registered observers will get called.
95 virtual void RequestDeviceRefresh() = 0;
96
97 // Cast to a receiver specified by |receiver_id|.
98 virtual void CastToReceiver(const std::string& receiver_id) = 0;
99
100 // Stop an ongoing cast (this should be a user initiated stop). |activity_id|
101 // is the identifier of the activity/route that should be stopped.
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
114 // Add or remove an observer.
115 virtual void AddObserver(Observer* observer) = 0;
116 virtual void RemoveObserver(Observer* observer) = 0;
117
118 private:
119 DISALLOW_ASSIGN(CastConfigDelegate);
120 };
121
122 } // namespace ash
123
124 #endif // ASH_CAST_CONFIG_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/cast_config_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698