summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy/configuration_policy_provider_delegate_win.h
blob: 8fc23858dc40404d9cc59df1a244b5649afaa27c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 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_CONFIGURATION_POLICY_PROVIDER_DELEGATE_WIN_H_
#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_DELEGATE_WIN_H_
#pragma once

#include "base/string16.h"
#include "chrome/browser/policy/asynchronous_policy_provider.h"
#include "chrome/browser/policy/policy_map.h"

namespace policy {

class ConfigurationPolicyProviderDelegateWin
    : public AsynchronousPolicyProvider::Delegate {
 public:
  ConfigurationPolicyProviderDelegateWin(
      const PolicyDefinitionList* policy_definition_list,
      const string16& registry_key,
      PolicyLevel level);
  virtual ~ConfigurationPolicyProviderDelegateWin() {}

  // AsynchronousPolicyProvider::Delegate overrides:
  virtual PolicyMap* Load() OVERRIDE;

 private:
  // Methods to perform type-specific policy lookups in the registry.
  // HKLM is checked first, then HKCU.

  // Reads a string registry value |name| at the specified |key| and puts the
  // resulting string in |result|. |scope| is MACHINE for keys loaded from
  // HKLM and USER for keys from HKCU.
  bool GetRegistryPolicyString(const string16& name,
                               string16* result,
                               PolicyScope* scope) const;
  // Gets a list value contained under |key| one level below the policy root.
  bool GetRegistryPolicyStringList(const string16& key,
                                   ListValue* result,
                                   PolicyScope* scope) const;
  bool GetRegistryPolicyBoolean(const string16& value_name,
                                bool* result,
                                PolicyScope* scope) const;
  bool GetRegistryPolicyInteger(const string16& value_name,
                                uint32* result,
                                PolicyScope* scope) const;

  const PolicyDefinitionList* policy_definition_list_;
  const string16 registry_key_;
  PolicyLevel level_;

  DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderDelegateWin);
};

}  // namespace policy

#endif  // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_DELEGATE_WIN_H_