OLD | NEW |
| (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 CHROME_BROWSER_CHROMEOS_ARC_ARC_POLICY_BRIDGE_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_POLICY_BRIDGE_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/arc/arc_service.h" | |
10 #include "components/arc/common/policy.mojom.h" | |
11 #include "components/arc/instance_holder.h" | |
12 #include "components/policy/core/common/policy_service.h" | |
13 #include "mojo/public/cpp/bindings/binding.h" | |
14 | |
15 namespace policy { | |
16 class PolicyMap; | |
17 } // namespace policy | |
18 | |
19 namespace arc { | |
20 | |
21 class ArcBridgeService; | |
22 | |
23 // Constants for the ARC certs sync mode are defined in the policy, please keep | |
24 // its in sync. | |
25 enum ArcCertsSyncMode : int32_t { | |
26 // Certificates sync is disabled. | |
27 SYNC_DISABLED = 0, | |
28 // Copy of CA certificates is enabled. | |
29 COPY_CA_CERTS = 1 | |
30 }; | |
31 | |
32 class ArcPolicyBridge : public ArcService, | |
33 public InstanceHolder<mojom::PolicyInstance>::Observer, | |
34 public mojom::PolicyHost, | |
35 public policy::PolicyService::Observer { | |
36 public: | |
37 explicit ArcPolicyBridge(ArcBridgeService* bridge_service); | |
38 ArcPolicyBridge(ArcBridgeService* bridge_service, | |
39 policy::PolicyService* policy_service); | |
40 ~ArcPolicyBridge() override; | |
41 | |
42 void OverrideIsManagedForTesting(bool is_managed); | |
43 | |
44 // InstanceHolder<mojom::PolicyInstance>::Observer overrides. | |
45 void OnInstanceReady() override; | |
46 void OnInstanceClosed() override; | |
47 | |
48 // PolicyHost overrides. | |
49 void GetPolicies(const GetPoliciesCallback& callback) override; | |
50 | |
51 // PolicyService::Observer overrides. | |
52 void OnPolicyUpdated(const policy::PolicyNamespace& ns, | |
53 const policy::PolicyMap& previous, | |
54 const policy::PolicyMap& current) override; | |
55 | |
56 private: | |
57 void InitializePolicyService(); | |
58 | |
59 mojo::Binding<PolicyHost> binding_; | |
60 policy::PolicyService* policy_service_ = nullptr; | |
61 bool is_managed_ = false; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(ArcPolicyBridge); | |
64 }; | |
65 | |
66 } // namespace arc | |
67 | |
68 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_POLICY_BRIDGE_H_ | |
OLD | NEW |