Chromium Code Reviews| Index: components/policy/android/java/src/org/chromium/policy/AppRestrictionsImporter.java |
| diff --git a/components/policy/android/java/src/org/chromium/policy/AppRestrictionsImporter.java b/components/policy/android/java/src/org/chromium/policy/AppRestrictionsImporter.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5de5d33760bb5f753acf581978a1df54b21c0d3b |
| --- /dev/null |
| +++ b/components/policy/android/java/src/org/chromium/policy/AppRestrictionsImporter.java |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.policy; |
| + |
| +import org.chromium.base.JNINamespace; |
| + |
| +/** |
| + * TODO: Insert description here. (generated by dgn) |
|
Bernhard Bauer
2015/07/08 09:54:33
:)
dgn
2015/07/08 18:16:01
Done.
|
| + */ |
| +@JNINamespace("policy") |
| +public class AppRestrictionsImporter { |
|
Bernhard Bauer
2015/07/08 09:54:33
Nit: Name this ...Converter?
dgn
2015/07/08 11:25:44
PolicyConverter even. This class will not be used
|
| + private long mNativeAppRestrictionsImporter = 0; |
| + |
| + public AppRestrictionsImporter() {} |
| + |
| + public void setNativeDelegate(long mNativeDelegate) { |
| + mNativeAppRestrictionsImporter = nativeInit(mNativeDelegate); |
| + } |
| + |
| + public void setPolicy(String key, Object value) { |
| + if (mNativeAppRestrictionsImporter == 0) return; |
|
Bernhard Bauer
2015/07/08 09:54:33
Can this actually happen?
dgn
2015/07/08 11:25:44
Not normally. If I set the delegate in the constru
|
| + if (value instanceof Boolean) { |
| + nativeSetPolicyBoolean(mNativeAppRestrictionsImporter, key, (Boolean) value); |
| + return; |
| + } |
| + if (value instanceof String) { |
| + nativeSetPolicyString(mNativeAppRestrictionsImporter, key, (String) value); |
| + return; |
| + } |
| + if (value instanceof Integer) { |
| + nativeSetPolicyInteger(mNativeAppRestrictionsImporter, key, (Integer) value); |
| + return; |
| + } |
| + if (value instanceof String[]) { |
| + nativeSetPolicyStringArray(mNativeAppRestrictionsImporter, key, (String[]) value); |
| + return; |
| + } |
| + assert false : "Invalid setting " + value + " for key " + key; |
| + } |
| + |
| + public void flushPolicies() { |
| + if (mNativeAppRestrictionsImporter == 0) return; |
| + nativeFlushPolicies(mNativeAppRestrictionsImporter); |
| + } |
| + |
| + private native long nativeInit(long delegatePtr); |
| + private native void nativeSetPolicyBoolean( |
| + long nativeAppRestrictionsImporter, String policyKey, boolean value); |
| + private native void nativeSetPolicyInteger( |
| + long nativeAppRestrictionsImporter, String policyKey, int value); |
| + private native void nativeSetPolicyString( |
| + long nativeAppRestrictionsImporter, String policyKey, String value); |
| + private native void nativeSetPolicyStringArray( |
| + long nativeAppRestrictionsImporter, String policyKey, String[] value); |
| + private native void nativeFlushPolicies(long nativeAppRestrictionsImporter); |
| +} |