Commit 8e44cb76 authored by Owen Min's avatar Owen Min Committed by Commit Bot

Update CBCM registar helper name

Change machine_level_user_cloud_policy_register_helper.h|cc to
  chrome_browser_cloud_management_helper.h|cc.
Change MachineLevelUserCloudPolicyRegistrar to
  ChromeBrowserCloudManagementRegistrar. Also change its memeber variable
  or function from *Policy* to *CloudManagement*.

Bug: 1010704
Change-Id: I7852de8d53ea0ff2b508e8f2f0b9ef762ce79c5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838332Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703426}
parent 12180c59
......@@ -4099,8 +4099,8 @@ jumbo_split_static_library("browser") {
"notifications/screen_lock_notification_blocker.cc",
"notifications/screen_lock_notification_blocker.h",
"platform_util.cc",
"policy/cloud/machine_level_user_cloud_policy_helper.cc",
"policy/cloud/machine_level_user_cloud_policy_helper.h",
"policy/cloud/chrome_browser_cloud_management_helper.cc",
"policy/cloud/chrome_browser_cloud_management_helper.h",
"policy/cloud/user_policy_signin_service.cc",
"policy/cloud/user_policy_signin_service.h",
"policy/cloud/user_policy_signin_service_internal.h",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/policy/cloud/machine_level_user_cloud_policy_helper.h"
#include "chrome/browser/policy/cloud/chrome_browser_cloud_management_helper.h"
#include <utility>
......@@ -32,19 +32,21 @@ void OnPolicyFetchCompleted(bool success) {
} // namespace
/* MachineLevelUserCloudPolicyRegistrar */
MachineLevelUserCloudPolicyRegistrar::MachineLevelUserCloudPolicyRegistrar(
/* ChromeBrowserCloudManagementRegistrar */
ChromeBrowserCloudManagementRegistrar::ChromeBrowserCloudManagementRegistrar(
DeviceManagementService* device_management_service,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: device_management_service_(device_management_service),
url_loader_factory_(url_loader_factory) {}
MachineLevelUserCloudPolicyRegistrar::~MachineLevelUserCloudPolicyRegistrar() {}
ChromeBrowserCloudManagementRegistrar::
~ChromeBrowserCloudManagementRegistrar() {}
void MachineLevelUserCloudPolicyRegistrar::RegisterForPolicyWithEnrollmentToken(
const std::string& enrollment_token,
const std::string& client_id,
const PolicyRegistrationCallback& callback) {
void ChromeBrowserCloudManagementRegistrar::
RegisterForCloudManagementWithEnrollmentToken(
const std::string& enrollment_token,
const std::string& client_id,
const CloudManagementRegistrationCallback& callback) {
DCHECK(!enrollment_token.empty());
DCHECK(!client_id.empty());
......@@ -74,14 +76,16 @@ void MachineLevelUserCloudPolicyRegistrar::RegisterForPolicyWithEnrollmentToken(
enterprise_management::DeviceRegisterRequest::BROWSER);
registration_helper_->StartRegistrationWithEnrollmentToken(
enrollment_token, client_id,
base::BindRepeating(
&MachineLevelUserCloudPolicyRegistrar::CallPolicyRegistrationCallback,
base::Unretained(this), base::Passed(&policy_client), callback));
base::BindRepeating(&ChromeBrowserCloudManagementRegistrar::
CallCloudManagementRegistrationCallback,
base::Unretained(this), base::Passed(&policy_client),
callback));
}
void MachineLevelUserCloudPolicyRegistrar::CallPolicyRegistrationCallback(
std::unique_ptr<CloudPolicyClient> client,
PolicyRegistrationCallback callback) {
void ChromeBrowserCloudManagementRegistrar::
CallCloudManagementRegistrationCallback(
std::unique_ptr<CloudPolicyClient> client,
CloudManagementRegistrationCallback callback) {
registration_helper_.reset();
if (callback)
callback.Run(client->dm_token(), client->client_id());
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_POLICY_CLOUD_MACHINE_LEVEL_USER_CLOUD_POLICY_HELPER_H_
#define CHROME_BROWSER_POLICY_CLOUD_MACHINE_LEVEL_USER_CLOUD_POLICY_HELPER_H_
#ifndef CHROME_BROWSER_POLICY_CLOUD_CHROME_BROWSER_CLOUD_MANAGEMENT_HELPER_H_
#define CHROME_BROWSER_POLICY_CLOUD_CHROME_BROWSER_CLOUD_MANAGEMENT_HELPER_H_
#include <memory>
#include <string>
......@@ -28,36 +28,37 @@ class MachineLevelUserCloudPolicyManager;
class DeviceManagementService;
// A helper class that register device with the enrollment token and client id.
class MachineLevelUserCloudPolicyRegistrar {
class ChromeBrowserCloudManagementRegistrar {
public:
MachineLevelUserCloudPolicyRegistrar(
ChromeBrowserCloudManagementRegistrar(
DeviceManagementService* device_management_service,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
~MachineLevelUserCloudPolicyRegistrar();
~ChromeBrowserCloudManagementRegistrar();
// The callback invoked once policy registration is complete. Passed
// |dm_token| and |client_id| parameters are empty if policy registration
// failed.
// TODO(crbug.com/825321): Update this to OnceCallback.
using PolicyRegistrationCallback =
using CloudManagementRegistrationCallback =
base::RepeatingCallback<void(const std::string& dm_token,
const std::string& client_id)>;
// Registers a CloudPolicyClient for fetching machine level user policy.
void RegisterForPolicyWithEnrollmentToken(
void RegisterForCloudManagementWithEnrollmentToken(
const std::string& enrollment_token,
const std::string& client_id,
const PolicyRegistrationCallback& callback);
const CloudManagementRegistrationCallback& callback);
private:
void CallPolicyRegistrationCallback(std::unique_ptr<CloudPolicyClient> client,
PolicyRegistrationCallback callback);
void CallCloudManagementRegistrationCallback(
std::unique_ptr<CloudPolicyClient> client,
CloudManagementRegistrationCallback callback);
std::unique_ptr<CloudPolicyClientRegistrationHelper> registration_helper_;
DeviceManagementService* device_management_service_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
DISALLOW_COPY_AND_ASSIGN(MachineLevelUserCloudPolicyRegistrar);
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserCloudManagementRegistrar);
};
// A helper class that setup registration and fetch policy.
......@@ -93,4 +94,4 @@ class MachineLevelUserCloudPolicyFetcher : public CloudPolicyService::Observer {
} // namespace policy
#endif // CHROME_BROWSER_POLICY_CLOUD_MACHINE_LEVEL_USER_CLOUD_POLICY_HELPER_H_
#endif // CHROME_BROWSER_POLICY_CLOUD_CHROME_BROWSER_CLOUD_MANAGEMENT_HELPER_H_
......@@ -24,7 +24,7 @@
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/policy/browser_dm_token_storage.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/policy/cloud/machine_level_user_cloud_policy_helper.h"
#include "chrome/browser/policy/cloud/chrome_browser_cloud_management_helper.h"
#include "chrome/browser/policy/machine_level_user_cloud_policy_register_watcher.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
......@@ -196,8 +196,9 @@ void MachineLevelUserCloudPolicyController::Init(
DCHECK(!enrollment_token.empty());
DCHECK(!client_id.empty());
policy_registrar_ = std::make_unique<MachineLevelUserCloudPolicyRegistrar>(
device_management_service, url_loader_factory);
cloud_management_registrar_ =
std::make_unique<ChromeBrowserCloudManagementRegistrar>(
device_management_service, url_loader_factory);
policy_fetcher_ = std::make_unique<MachineLevelUserCloudPolicyFetcher>(
policy_manager, local_state, device_management_service,
url_loader_factory);
......@@ -209,10 +210,10 @@ void MachineLevelUserCloudPolicyController::Init(
enrollment_start_time_ = base::Time::Now();
// Not registered already, so do it now.
policy_registrar_->RegisterForPolicyWithEnrollmentToken(
cloud_management_registrar_->RegisterForCloudManagementWithEnrollmentToken(
enrollment_token, client_id,
base::Bind(&MachineLevelUserCloudPolicyController::
RegisterForPolicyWithEnrollmentTokenCallback,
RegisterForCloudManagementWithEnrollmentTokenCallback,
base::Unretained(this)));
#if defined(OS_WIN)
// This metric is only published on Windows to indicate how many user level
......@@ -285,8 +286,9 @@ bool MachineLevelUserCloudPolicyController::GetEnrollmentTokenAndClientId(
}
void MachineLevelUserCloudPolicyController::
RegisterForPolicyWithEnrollmentTokenCallback(const std::string& dm_token,
const std::string& client_id) {
RegisterForCloudManagementWithEnrollmentTokenCallback(
const std::string& dm_token,
const std::string& client_id) {
base::TimeDelta enrollment_time = base::Time::Now() - enrollment_start_time_;
if (dm_token.empty()) {
......
......@@ -25,11 +25,11 @@ class ReportScheduler;
}
namespace policy {
class ChromeBrowserCloudManagementRegistrar;
class ConfigurationPolicyProvider;
class MachineLevelUserCloudPolicyManager;
class MachineLevelUserCloudPolicyFetcher;
class MachineLevelUserCloudPolicyRegisterWatcher;
class MachineLevelUserCloudPolicyRegistrar;
// A class that setups and manages MachineLevelUserCloudPolicy.
class MachineLevelUserCloudPolicyController {
......@@ -94,7 +94,7 @@ class MachineLevelUserCloudPolicyController {
private:
bool GetEnrollmentTokenAndClientId(std::string* enrollment_token,
std::string* client_id);
void RegisterForPolicyWithEnrollmentTokenCallback(
void RegisterForCloudManagementWithEnrollmentTokenCallback(
const std::string& dm_token,
const std::string& client_id);
......@@ -104,7 +104,8 @@ class MachineLevelUserCloudPolicyController {
base::ObserverList<Observer, true>::Unchecked observers_;
std::unique_ptr<MachineLevelUserCloudPolicyRegistrar> policy_registrar_;
std::unique_ptr<ChromeBrowserCloudManagementRegistrar>
cloud_management_registrar_;
std::unique_ptr<MachineLevelUserCloudPolicyFetcher> policy_fetcher_;
// This is an observer of the controller and needs to be declared after the
// |observers_|.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment