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

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

Issue 2525563003: mash: Change CastConfigDelegate to a mojoified CastConfigClient. (Closed)
Patch Set: Now for the external apitests as well. Created 4 years 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 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_CLIENT_PROXY_H_
6 #define ASH_COMMON_CAST_CONFIG_CLIENT_PROXY_H_
7
8 #include "ash/public/interfaces/cast_config.mojom.h"
9 #include "base/macros.h"
10 #include "mojo/public/cpp/bindings/associated_binding.h"
11
12 namespace service_manager {
13 class Connector;
14 }
15
16 namespace ash {
17
18 // We want to establish our connection lazily and preferably only once, as
19 // TrayCast instances will come and go.
20 class CastConfigClientProxy : public ash::mojom::CastConfigClient {
21 public:
22 CastConfigClientProxy(service_manager::Connector* connector);
James Cook 2016/11/30 22:16:38 explicit
23 ~CastConfigClientProxy() override;
24
25 // Binds an AssociatedBinding to the associated group of our pipe, and passes
26 // the result to AddObserver().
27 void AddObserverBinding(
28 mojo::AssociatedBinding<mojom::CastConfigObserver>* observer_binding);
29
30 // Returns whether we can connect to the remote client. This is used to
31 // ensure that UI elements are hidden when no connection to the remote
32 // client is possible.
33 bool CanConnect();
34
35 // ash::mojom::CastConfigClient:
36 void RequestDeviceRefresh() override;
37 void CastToSink(mojom::CastSinkPtr sink) override;
38 void StopCasting(mojom::CastRoutePtr route) override;
39 void AddObserver(
40 mojom::CastConfigObserverAssociatedPtrInfo observer) override;
41
42 private:
43 // Ensures that we have a valid |client_| before we try to use it.
44 bool ConnectToClient();
45
46 // Clears |client_| when |client_| has a connection error.
47 void OnClientConnectionError();
48
49 service_manager::Connector* connector_;
50 mojom::CastConfigClientPtr client_;
51
52 DISALLOW_COPY_AND_ASSIGN(CastConfigClientProxy);
53 };
54
55 } // namespace ash
56
57 #endif // ASH_COMMON_CAST_CONFIG_CLIENT_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698