Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/policy/PolicyManager.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/policy/PolicyManager.java b/chrome/android/java/src/org/chromium/chrome/browser/policy/PolicyManager.java |
| index 9856dba21407b9e677c736a33b7ae854ef4fa472..b4496475faf0a5f859a918f5b7c825b52d3e336d 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/policy/PolicyManager.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/policy/PolicyManager.java |
| @@ -8,6 +8,7 @@ |
| import org.chromium.base.CalledByNative; |
| import org.chromium.base.ThreadUtils; |
| +import org.chromium.policy.AppRestrictionsImporter; |
| import java.util.ArrayList; |
| import java.util.List; |
| @@ -19,13 +20,16 @@ |
| public class PolicyManager { |
| private long mNativePolicyManager; |
| + private AppRestrictionsImporter mAppRestrictionsImporter; |
| private final List<PolicyProvider> mPolicyProviders = new ArrayList<>(); |
| private final List<Bundle> mCachedPolicies = new ArrayList<>(); |
| private final List<PolicyChangeListener> mPolicyChangeListeners = new ArrayList<>(); |
| public void initializeNative() { |
| ThreadUtils.assertOnUiThread(); |
| + mAppRestrictionsImporter = new AppRestrictionsImporter(); |
| mNativePolicyManager = nativeInit(); |
| + mAppRestrictionsImporter.setNativeDelegate(mNativePolicyManager); |
|
Bernhard Bauer
2015/07/08 09:54:33
Can't you just pass the native pointer into the co
dgn
2015/07/08 11:25:44
It should not cause any issue, since providers are
dgn
2015/07/08 18:16:00
The reverse is now done. The PolicyConverter is cr
|
| } |
| /** |
| @@ -61,27 +65,10 @@ void onSettingsAvailable(int source, Bundle newSettings) { |
| } |
| for (Bundle settings : mCachedPolicies) { |
| for (String key : settings.keySet()) { |
| - Object value = settings.get(key); |
| - if (value instanceof Boolean) { |
| - nativeSetPolicyBoolean(mNativePolicyManager, key, (Boolean) value); |
| - continue; |
| - } |
| - if (value instanceof String) { |
| - nativeSetPolicyString(mNativePolicyManager, key, (String) value); |
| - continue; |
| - } |
| - if (value instanceof Integer) { |
| - nativeSetPolicyInteger(mNativePolicyManager, key, (Integer) value); |
| - continue; |
| - } |
| - if (value instanceof String[]) { |
| - nativeSetPolicyStringArray(mNativePolicyManager, key, (String[]) value); |
| - continue; |
| - } |
| - assert false : "Invalid setting " + value + " for key " + key; |
| + mAppRestrictionsImporter.setPolicy(key, settings.get(key)); |
| } |
| } |
| - nativeFlushPolicies(mNativePolicyManager); |
| + mAppRestrictionsImporter.flushPolicies(); |
| } |
| void terminateIncognitoSession() { |
| @@ -122,14 +109,4 @@ private void refreshPolicies() { |
| private native long nativeInit(); |
| private native void nativeDestroy(long nativePolicyManager); |
| - |
| - private native void nativeSetPolicyBoolean( |
| - long nativePolicyManager, String policyKey, boolean value); |
| - private native void nativeSetPolicyInteger( |
| - long nativePolicyManager, String policyKey, int value); |
| - private native void nativeSetPolicyString( |
| - long nativePolicyManager, String policyKey, String value); |
| - private native void nativeSetPolicyStringArray( |
| - long nativePolicyManager, String policyKey, String[] value); |
| - private native void nativeFlushPolicies(long nativePolicyManager); |
| } |