Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Unified Diff: components/policy/core/browser/android/app_restrictions_importer.h

Issue 1220683008: Move AppRestriction to Policy code out of //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix imports & compilation Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/policy/core/browser/android/app_restrictions_importer.h
diff --git a/chrome/browser/android/policy/policy_manager.h b/components/policy/core/browser/android/app_restrictions_importer.h
similarity index 64%
copy from chrome/browser/android/policy/policy_manager.h
copy to components/policy/core/browser/android/app_restrictions_importer.h
index a24650d6f131d61961b37c0b1d4f58dd1d046ae0..723844ffd1291e52db1b34e56afd6513becb62e1 100644
--- a/chrome/browser/android/policy/policy_manager.h
+++ b/components/policy/core/browser/android/app_restrictions_importer.h
@@ -2,27 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_ANDROID_POLICY_POLICY_MANAGER_H_
-#define CHROME_BROWSER_ANDROID_POLICY_POLICY_MANAGER_H_
+#ifndef COMPONENTS_POLICY_CORE_BROWSER_ANDROID_APP_RESTRICTIONS_IMPORTER_H
+#define COMPONENTS_POLICY_CORE_BROWSER_ANDROID_APP_RESTRICTIONS_IMPORTER_H
#include <jni.h>
+#include "base/memory/scoped_ptr.h"
bartfab (slow) 2015/07/03 16:55:48 Nit: Add blank line above.
dgn 2015/07/06 17:34:03 Done.
+#include "components/policy/policy_export.h"
-#include "base/android/jni_weak_ref.h"
-#include "components/policy/core/common/policy_bundle.h"
-#include "components/policy/core/common/policy_provider_android_delegate.h"
+namespace base {
+class Value;
+}
namespace policy {
+class PolicyBundle;
class PolicyProviderAndroid;
class Schema;
+struct PolicyNamespace;
-} // namespace policy
-
-class PolicyManager : public policy::PolicyProviderAndroidDelegate {
+class POLICY_EXPORT AppRestrictionsImporter {
bartfab (slow) 2015/07/03 16:55:48 Nit: Add a short comment that explains what this c
dgn 2015/07/06 17:34:03 Done.
public:
- PolicyManager(JNIEnv* env, jobject obj);
+ AppRestrictionsImporter();
- // Called from Java:
+ // To be called from Java:
void SetPolicyBoolean(JNIEnv* env,
jobject obj,
jstring policyKey,
@@ -54,25 +56,27 @@ class PolicyManager : public policy::PolicyProviderAndroidDelegate {
// Public for testing.
static base::Value* ConvertValueToSchema(base::Value* raw_value,
bartfab (slow) 2015/07/03 16:55:48 Please change |raw_value| and the return value to
dgn 2015/07/06 17:34:03 Done.
const policy::Schema& schema);
+ protected:
+ ~AppRestrictionsImporter();
- // PolicyProviderAndroidDelegate:
- void RefreshPolicies() override;
- void PolicyProviderShutdown() override;
+ // Returns the Schema for policy named |key|
bartfab (slow) 2015/07/03 16:55:48 Nit 1: s/for/for the/ Nit 2: Add a full stop at th
dgn 2015/07/06 17:34:03 Removed the method. (see next comment)
+ virtual Schema GetPolicySchema(const std::string& key) = 0;
bartfab (slow) 2015/07/03 16:55:48 1: Nit: #include <string> 2: Why not use GetPolicy
dgn 2015/07/06 17:34:03 I wanted to remove explicit chrome references, by
- private:
- ~PolicyManager() override;
+ // Returns the PolicyProvider that will receive the new policies.
+ virtual PolicyProviderAndroid* GetPolicyProvider() = 0;
- JavaObjectWeakGlobalRef weak_java_policy_manager_;
+ // Returns the namespace for the new policies. The default implementation
+ // returns an empty namespace in the domain policy::POLICY_DOMAIN_CHROME
bartfab (slow) 2015/07/03 16:55:48 Nit 1: Add a full stop at the end. Nit 2: That nam
dgn 2015/07/06 17:34:03 Done.
+ virtual PolicyNamespace GetPolicyNamespace();
bartfab (slow) 2015/07/03 16:55:48 Why does this method exist, if nobody ever overrid
dgn 2015/07/06 17:34:04 Done.
+ private:
scoped_ptr<policy::PolicyBundle> policy_bundle_;
bartfab (slow) 2015/07/03 16:55:48 Nit: s/policy:://
dgn 2015/07/06 17:34:03 Done.
- policy::PolicyProviderAndroid* policy_provider_;
void SetPolicyValue(const std::string& key, base::Value* value);
- DISALLOW_COPY_AND_ASSIGN(PolicyManager);
+ DISALLOW_COPY_AND_ASSIGN(AppRestrictionsImporter);
bartfab (slow) 2015/07/03 16:55:48 Nit: #include "base/macros.h"
dgn 2015/07/06 17:34:03 Done.
};
-// Register native methods
-bool RegisterPolicyManager(JNIEnv* env);
+} // namespace policy
-#endif // CHROME_BROWSER_ANDROID_POLICY_POLICY_MANAGER_H_
+#endif // COMPONENTS_POLICY_CORE_BROWSER_ANDROID_APP_RESTRICTIONS_IMPORTER_H

Powered by Google App Engine
This is Rietveld 408576698