Chromium Code Reviews| Index: chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc |
| diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc |
| index 0b31559bbb6c8a7fc97635f8758598fbf1e385af..132a019b0e8c0a23bb4bd21493e52f4ca46c9426 100644 |
| --- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc |
| +++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc |
| @@ -4,6 +4,7 @@ |
| #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| +#include "base/command_line.h" |
| #include "base/files/file_path.h" |
| #include "base/logging.h" |
| #include "base/message_loop/message_loop_proxy.h" |
| @@ -22,6 +23,7 @@ |
| #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| #include "chrome/browser/chromeos/settings/cros_settings.h" |
| #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| +#include "chrome/browser/policy/device_management_service_configuration.h" |
| #include "chrome/common/pref_names.h" |
| #include "chromeos/chromeos_paths.h" |
| #include "chromeos/chromeos_switches.h" |
| @@ -46,6 +48,13 @@ namespace policy { |
| namespace { |
| +// TODO(davidyu): Update the URL to the real one once it is ready. |
| +// http://crbug.com/366491. |
| +// |
| +// The URL for the consumer device management server. |
| +const char kDefaultConsumerDeviceManagementServerUrl[] = |
| + "https://m.google.com/devicemanagement/data/api"; |
| + |
| // Install attributes for tests. |
| EnterpriseInstallAttributes* g_testing_install_attributes = NULL; |
| @@ -58,6 +67,16 @@ scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { |
| pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| } |
| +std::string GetConsumerDeviceManagementServerUrl() { |
|
bartfab (slow)
2014/04/25 09:17:35
Nit: #include <string>
davidyu
2014/04/28 02:58:22
Done.
|
| + CommandLine* command_line = CommandLine::ForCurrentProcess(); |
|
bartfab (slow)
2014/04/25 09:17:35
Nit: const.
davidyu
2014/04/28 02:58:22
Done.
|
| + if (command_line->HasSwitch( |
| + chromeos::switches::kConsumerDeviceManagementUrl)) { |
| + return command_line->GetSwitchValueASCII( |
| + chromeos::switches::kConsumerDeviceManagementUrl); |
| + } |
| + return kDefaultConsumerDeviceManagementServerUrl; |
| +}; |
| + |
| } // namespace |
| BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS() |
| @@ -110,6 +129,14 @@ void BrowserPolicyConnectorChromeOS::Init( |
| scoped_refptr<net::URLRequestContextGetter> request_context) { |
| ChromeBrowserPolicyConnector::Init(local_state, request_context); |
| + scoped_ptr<DeviceManagementService::Configuration> configuration( |
| + new DeviceManagementServiceConfiguration( |
| + GetConsumerDeviceManagementServerUrl())); |
| + consumer_device_management_service_.reset( |
| + new DeviceManagementService(configuration.Pass())); |
| + consumer_device_management_service_->ScheduleInitialization( |
| + kServiceInitializationStartupDelay); |
| + |
| if (device_cloud_policy_manager_) { |
| // Note: for now the |device_cloud_policy_manager_| is using the global |
| // schema registry. Eventually it will have its own registry, once device |