Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / chrome / browser / policy / profile_policy_connector.h
blobb8a32951d2a497739bd946bb34915b083ea640c5
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
6 #define CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/keyed_service/core/keyed_service.h"
14 namespace user_manager {
15 class User;
18 namespace policy {
20 class CloudPolicyManager;
21 class ConfigurationPolicyProvider;
22 class PolicyService;
23 class SchemaRegistry;
25 // A KeyedService that creates and manages the per-Profile policy
26 // components.
27 class ProfilePolicyConnector : public KeyedService {
28 public:
29 ProfilePolicyConnector();
30 ~ProfilePolicyConnector() override;
32 // If |force_immediate_load| then disk caches will be loaded synchronously.
33 void Init(bool force_immediate_load,
34 #if defined(OS_CHROMEOS)
35 const user_manager::User* user,
36 #endif
37 SchemaRegistry* schema_registry,
38 CloudPolicyManager* user_cloud_policy_manager);
40 void InitForTesting(scoped_ptr<PolicyService> service);
42 // KeyedService:
43 void Shutdown() override;
45 // This is never NULL.
46 PolicyService* policy_service() const { return policy_service_.get(); }
48 // Returns true if this Profile is under cloud policy management.
49 bool IsManaged() const;
51 // Returns the cloud policy management domain, if this Profile is under
52 // cloud policy management. Otherwise returns an empty string.
53 std::string GetManagementDomain() const;
55 // Returns true if the |name| Chrome policy is currently set via the
56 // CloudPolicyManager and isn't being overridden by a higher-level provider.
57 bool IsPolicyFromCloudPolicy(const char* name) const;
59 private:
60 #if defined(ENABLE_CONFIGURATION_POLICY)
61 #if defined(OS_CHROMEOS)
62 // Some of the user policy configuration affects browser global state, and
63 // can only come from one Profile. |is_primary_user_| is true if this
64 // connector belongs to the first signed-in Profile, and in that case that
65 // Profile's policy is the one that affects global policy settings in
66 // local state.
67 bool is_primary_user_;
69 scoped_ptr<ConfigurationPolicyProvider> special_user_policy_provider_;
70 #endif // defined(OS_CHROMEOS)
72 scoped_ptr<ConfigurationPolicyProvider> wrapped_platform_policy_provider_;
73 CloudPolicyManager* user_cloud_policy_manager_;
74 #endif // defined(ENABLE_CONFIGURATION_POLICY)
76 scoped_ptr<PolicyService> policy_service_;
78 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector);
81 } // namespace policy
83 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_