chromium/chrome/enterprise_companion/device_management_storage/dm_storage.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/enterprise_companion/device_management_storage/dm_storage.h"

#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>

#include "base/base64.h"
#include "base/check.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/important_file_writer.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"
#include "build/build_config.h"
#include "components/policy/proto/device_management_backend.pb.h"

namespace device_management_storage {

namespace {

// This DM Token value is persisted if the server asks the client to invalidate
// the DM Token.
constexpr char kInvalidTokenValue[] =;

// This is the standard name for the file that PersistPolicies() uses to store
// a PolicyFetchResponse received from the DMServer during the previous request.
// The data within the PolicyFetchResponse, such as the public key, version, and
// timestamp are used for subsequent requests and validations of DMServer
// responses.
constexpr char kPolicyInfoFileName[] =;

// This is the standard name for the file that PersistPolicies() uses for each
// {policy_type} that it receives from the DMServer.
constexpr char kPolicyFileName[] =;

// Deletes the child directories in the cache root if they do not appear in
// `exclusion_set`.
bool DeletePolicies(const base::FilePath& cache_root,
                    const std::set<std::string>& exclusion_set) {}

bool MakePathGlobalAccessible(const base::FilePath& path) {}

class DMStorageImpl final : public DMStorage {};

}  // namespace

bool CreateGlobalAccessibleDirectory(const base::FilePath& path) {}

bool WriteContentToGlobalReadableFile(const base::FilePath& path,
                                      const std::string& content) {}

bool CachedPolicyInfo::Populate(const std::string& raw_response) {}

scoped_refptr<DMStorage> CreateDMStorage(
    const base::FilePath& policy_cache_root,
    std::unique_ptr<TokenServiceInterface> token_service) {}

}  // namespace device_management_storage