| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package org.chromium.policy; | 5 package org.chromium.policy; |
| 6 | 6 |
| 7 import android.os.Bundle; | 7 import android.os.Bundle; |
| 8 | 8 |
| 9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
| 10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
| 11 import org.chromium.base.annotations.CalledByNative; | 11 import org.chromium.base.annotations.CalledByNative; |
| 12 import org.chromium.base.annotations.JNINamespace; | 12 import org.chromium.base.annotations.JNINamespace; |
| 13 | 13 |
| 14 import java.util.ArrayList; | 14 import java.util.ArrayList; |
| 15 import java.util.List; | 15 import java.util.List; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * Reads enterprise policies from one or more policy providers and plumbs them t
hrough to the policy | 18 * Reads enterprise policies from one or more policy providers and plumbs them t
hrough to the policy |
| 19 * subsystem. | 19 * subsystem. |
| 20 */ | 20 */ |
| 21 @JNINamespace("policy::android") | 21 @JNINamespace("policy::android") |
| 22 public class CombinedPolicyProvider { | 22 public class CombinedPolicyProvider { |
| 23 private static CombinedPolicyProvider sInstance = null; | 23 private static CombinedPolicyProvider sInstance; |
| 24 | 24 |
| 25 private long mNativeCombinedPolicyProvider = 0; | 25 private long mNativeCombinedPolicyProvider; |
| 26 | 26 |
| 27 private PolicyConverter mPolicyConverter; | 27 private PolicyConverter mPolicyConverter; |
| 28 private final List<PolicyProvider> mPolicyProviders = new ArrayList<>(); | 28 private final List<PolicyProvider> mPolicyProviders = new ArrayList<>(); |
| 29 private final List<Bundle> mCachedPolicies = new ArrayList<>(); | 29 private final List<Bundle> mCachedPolicies = new ArrayList<>(); |
| 30 private final List<PolicyChangeListener> mPolicyChangeListeners = new ArrayL
ist<>(); | 30 private final List<PolicyChangeListener> mPolicyChangeListeners = new ArrayL
ist<>(); |
| 31 | 31 |
| 32 public static CombinedPolicyProvider get() { | 32 public static CombinedPolicyProvider get() { |
| 33 if (sInstance == null) { | 33 if (sInstance == null) { |
| 34 sInstance = new CombinedPolicyProvider(); | 34 sInstance = new CombinedPolicyProvider(); |
| 35 } | 35 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 public static void set(CombinedPolicyProvider p) { | 136 public static void set(CombinedPolicyProvider p) { |
| 137 sInstance = p; | 137 sInstance = p; |
| 138 } | 138 } |
| 139 | 139 |
| 140 @VisibleForTesting | 140 @VisibleForTesting |
| 141 CombinedPolicyProvider() {} | 141 CombinedPolicyProvider() {} |
| 142 | 142 |
| 143 @VisibleForTesting | 143 @VisibleForTesting |
| 144 protected native void nativeFlushPolicies(long nativeAndroidCombinedPolicyPr
ovider); | 144 protected native void nativeFlushPolicies(long nativeAndroidCombinedPolicyPr
ovider); |
| 145 } | 145 } |
| OLD | NEW |