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