summaryrefslogtreecommitdiff
path: root/chromium/components/policy/core/common/legacy_chrome_policy_migrator.h
blob: 0012b6463ecd05a4f95d4bb44783f9fbfd7bc587 (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
// Copyright 2020 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 COMPONENTS_POLICY_CORE_COMMON_LEGACY_CHROME_POLICY_MIGRATOR_H_
#define COMPONENTS_POLICY_CORE_COMMON_LEGACY_CHROME_POLICY_MIGRATOR_H_

#include "components/policy/core/common/policy_migrator.h"

namespace policy {

// LegacyChromePolicyMigrator migrates a deprecated Chrome domain policy to a
// new name, setting up the new policy based on the old one.
//
// This is intended to be used for policies that do not have a corresponding
// pref. If the policy has a pref, please use
// |LegacyPoliciesDeprecatingPolicyHandler| instead.
class POLICY_EXPORT LegacyChromePolicyMigrator : public PolicyMigrator {
 public:
  using Migration = PolicyMigrator::Migration;

  LegacyChromePolicyMigrator(const char* old_name, const char* new_name);
  LegacyChromePolicyMigrator(const char* old_name,
                             const char* new_name,
                             Migration::ValueTransform transform);
  ~LegacyChromePolicyMigrator() override;

  LegacyChromePolicyMigrator(const LegacyChromePolicyMigrator&) = delete;
  LegacyChromePolicyMigrator& operator=(const LegacyChromePolicyMigrator&) =
      delete;

  void Migrate(policy::PolicyBundle* bundle) override;

 private:
  Migration migration_;
};

}  // namespace policy

#endif  // COMPONENTS_POLICY_CORE_COMMON_LEGACY_CHROME_POLICY_MIGRATOR_H_