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