Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / policy / profile_policy_connector.h
index 92e65b8..cc29d09 100644 (file)
@@ -9,9 +9,9 @@
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+#include "components/keyed_service/core/keyed_service.h"
 
-namespace chromeos {
+namespace user_manager {
 class User;
 }
 
@@ -22,9 +22,9 @@ class ConfigurationPolicyProvider;
 class PolicyService;
 class SchemaRegistry;
 
-// A BrowserContextKeyedService that creates and manages the per-Profile policy
+// A KeyedService that creates and manages the per-Profile policy
 // components.
-class ProfilePolicyConnector : public BrowserContextKeyedService {
+class ProfilePolicyConnector : public KeyedService {
  public:
   ProfilePolicyConnector();
   virtual ~ProfilePolicyConnector();
@@ -32,26 +32,33 @@ class ProfilePolicyConnector : public BrowserContextKeyedService {
   // If |force_immediate_load| then disk caches will be loaded synchronously.
   void Init(bool force_immediate_load,
 #if defined(OS_CHROMEOS)
-            const chromeos::User* user,
+            const user_manager::User* user,
 #endif
             SchemaRegistry* schema_registry,
             CloudPolicyManager* user_cloud_policy_manager);
 
   void InitForTesting(scoped_ptr<PolicyService> service);
 
-  // BrowserContextKeyedService:
+  // KeyedService:
   virtual void Shutdown() OVERRIDE;
 
   // This is never NULL.
   PolicyService* policy_service() const { return policy_service_.get(); }
 
+  // Returns true if this Profile is under cloud policy management.
+  bool IsManaged() const;
+
+  // Returns the cloud policy management domain, if this Profile is under
+  // cloud policy management. Otherwise returns an empty string.
+  std::string GetManagementDomain() const;
+
+  // Returns true if the |name| Chrome policy is currently set via the
+  // CloudPolicyManager and isn't being overridden by a higher-level provider.
+  bool IsPolicyFromCloudPolicy(const char* name) const;
+
  private:
 #if defined(ENABLE_CONFIGURATION_POLICY)
 #if defined(OS_CHROMEOS)
-  void InitializeDeviceLocalAccountPolicyProvider(
-      const std::string& username,
-      SchemaRegistry* schema_registry);
-
   // Some of the user policy configuration affects browser global state, and
   // can only come from one Profile. |is_primary_user_| is true if this
   // connector belongs to the first signed-in Profile, and in that case that
@@ -63,6 +70,7 @@ class ProfilePolicyConnector : public BrowserContextKeyedService {
 #endif  // defined(OS_CHROMEOS)
 
   scoped_ptr<ConfigurationPolicyProvider> forwarding_policy_provider_;
+  CloudPolicyManager* user_cloud_policy_manager_;
 #endif  // defined(ENABLE_CONFIGURATION_POLICY)
 
   scoped_ptr<PolicyService> policy_service_;