blob: afb5d54bf7697ffc33bcc83f28f3eda17b531f68 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2015 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Alex Deymo30534502015-07-20 15:06:33 -070016
17#ifndef UPDATE_ENGINE_LIBCROS_PROXY_H_
18#define UPDATE_ENGINE_LIBCROS_PROXY_H_
19
20#include <memory>
21
22#include <base/macros.h>
23#include <dbus/bus.h>
24
Alex Deymob8803bb2015-08-19 23:14:49 -070025#include "libcros/dbus-proxies.h"
Alex Deymo30534502015-07-20 15:06:33 -070026
27namespace chromeos_update_engine {
28
29// This class handles the DBus connection with chrome to resolve proxies. This
30// is a thin class to just hold the generated proxies (real or mocked ones).
31class LibCrosProxy final {
32 public:
33 explicit LibCrosProxy(const scoped_refptr<dbus::Bus>& bus);
34 LibCrosProxy(
35 std::unique_ptr<org::chromium::LibCrosServiceInterfaceProxyInterface>
36 service_interface_proxy,
37 std::unique_ptr<
38 org::chromium::
39 UpdateEngineLibcrosProxyResolvedInterfaceProxyInterface>
40 ue_proxy_resolved_interface);
41
42 ~LibCrosProxy() = default;
43
44 // Getters for the two proxies.
45 org::chromium::LibCrosServiceInterfaceProxyInterface*
46 service_interface_proxy();
47 org::chromium::UpdateEngineLibcrosProxyResolvedInterfaceProxyInterface*
48 ue_proxy_resolved_interface();
49
50 private:
51 std::unique_ptr<org::chromium::LibCrosServiceInterfaceProxyInterface>
52 service_interface_proxy_;
53 std::unique_ptr<
54 org::chromium::UpdateEngineLibcrosProxyResolvedInterfaceProxyInterface>
55 ue_proxy_resolved_interface_;
56
57 DISALLOW_COPY_AND_ASSIGN(LibCrosProxy);
58};
59
60} // namespace chromeos_update_engine
61
62#endif // UPDATE_ENGINE_LIBCROS_PROXY_H_