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

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

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 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/common/ash_view_ids.h ('k') | ash/common/cast_config_controller.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 2016 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_COMMON_CAST_CONFIG_CONTROLLER_H_
6 #define ASH_COMMON_CAST_CONFIG_CONTROLLER_H_
7
8 #include <vector>
9
10 #include "ash/public/interfaces/cast_config.mojom.h"
11 #include "base/macros.h"
12 #include "base/observer_list.h"
13 #include "mojo/public/cpp/bindings/associated_binding.h"
14 #include "mojo/public/cpp/bindings/binding_set.h"
15
16 namespace ash {
17
18 // There is a single CastConfigController which receives device
19 // information. This observer interface sends that information to all the
20 // TrayCast items--there is one per display.
21 class CastConfigControllerObserver {
22 public:
23 virtual void OnDevicesUpdated(
24 std::vector<mojom::SinkAndRoutePtr> devices) = 0;
25
26 protected:
27 virtual ~CastConfigControllerObserver() {}
28 };
29
30 // We want to establish our connection lazily and preferably only once, as
31 // TrayCast instances will come and go.
32 class CastConfigController : public ash::mojom::CastConfig,
33 public ash::mojom::CastConfigClient {
34 public:
35 CastConfigController();
36 ~CastConfigController() override;
37
38 // Returns whether our SetClient() method has been called and the client
39 // object pointer is still live.
40 bool Connected();
41
42 void AddObserver(CastConfigControllerObserver* observer);
43 void RemoveObserver(CastConfigControllerObserver* observer);
44
45 void BindRequest(mojom::CastConfigRequest request);
46
47 // ash::mojom::CastConfig:
48 void SetClient(mojom::CastConfigClientAssociatedPtrInfo client) override;
49 void OnDevicesUpdated(std::vector<mojom::SinkAndRoutePtr> devices) override;
50
51 // ash::mojom::CastConfigClient:
52 void RequestDeviceRefresh() override;
53 void CastToSink(mojom::CastSinkPtr sink) override;
54 void StopCasting(mojom::CastRoutePtr route) override;
55
56 private:
57 // Bindings for the CastConfig interface.
58 mojo::BindingSet<mojom::CastConfig> bindings_;
59
60 mojom::CastConfigClientAssociatedPtr client_;
61
62 base::ObserverList<CastConfigControllerObserver> observers_;
63
64 DISALLOW_COPY_AND_ASSIGN(CastConfigController);
65 };
66
67 } // namespace ash
68
69 #endif // ASH_COMMON_CAST_CONFIG_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/common/ash_view_ids.h ('k') | ash/common/cast_config_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698