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

Unified Diff: chrome/browser/policy/managed_mode_policy_provider.h

Issue 10510006: Add ManagedModePolicyProvider and extension API to get and set policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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: chrome/browser/policy/managed_mode_policy_provider.h
diff --git a/chrome/browser/policy/managed_mode_policy_provider.h b/chrome/browser/policy/managed_mode_policy_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..fb7d2c10be407cd366929c063f5169139905a413
--- /dev/null
+++ b/chrome/browser/policy/managed_mode_policy_provider.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2012 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.
+
+#ifndef CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_
+#define CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_
+#pragma once
+
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/policy/configuration_policy_provider.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "chrome/common/persistent_pref_store.h"
+
+class Profile;
+
+namespace policy {
+
Mattias Nissler (ping if slow) 2012/06/06 17:22:09 Please put a comment describing what this class is
Bernhard Bauer 2012/06/08 10:06:44 Done.
+class ManagedModePolicyProvider
Joao da Silva 2012/06/06 16:36:38 Please keep the declaration order in the .h and th
Bernhard Bauer 2012/06/08 10:06:44 Done.
+ : public ProfileKeyedService,
+ public ConfigurationPolicyProvider,
+ public PrefStore::Observer {
+ public:
+ explicit ManagedModePolicyProvider(Profile* profile);
+ virtual ~ManagedModePolicyProvider();
+
+ // Returns the stored value for a policy with the given |key|, or NULL if no
+ // such policy is defined.
+ const base::Value* GetPolicy(const std::string& key) const;
+ // Sets the policy with the given |key| to a copy of the given |value|.
+ void SetPolicy(const std::string& key, const base::Value* value);
+
+ // ConfigurationPolicyProvider implementation:
+ virtual void RefreshPolicies() OVERRIDE;
+ virtual bool IsInitializationComplete() const OVERRIDE;
+
+ // PrefStore::Observer implementation:
+ virtual void OnPrefValueChanged(const std::string& key) OVERRIDE;
+ virtual void OnInitializationCompleted(bool success) OVERRIDE;
+
+ private:
+ base::DictionaryValue* GetPolicyDictionary() const;
+ void UpdatePolicies();
+
Mattias Nissler (ping if slow) 2012/06/06 17:22:09 Put a comment explaining that this is used for per
Bernhard Bauer 2012/06/08 10:06:44 Done.
+ scoped_refptr<PersistentPrefStore> store_;
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698