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..c4ec41c3bfcf043cc139051605d6406b4d2ca1a2 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,22 @@ scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { |
| pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| } |
| +class ConsumerDeviceManagementServiceConfiguration |
| + : public DeviceManagementServiceConfiguration { |
| + public: |
| + virtual ~ConsumerDeviceManagementServiceConfiguration() {} |
| + |
| + virtual std::string GetServerUrl() OVERRIDE { |
| + CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| + if (command_line->HasSwitch( |
| + chromeos::switches::kConsumerDeviceManagementUrl)) |
|
Mattias Nissler (ping if slow)
2014/04/24 11:38:12
nit: curlies for readability please
davidyu
2014/04/25 01:45:40
Done.
|
| + return command_line->GetSwitchValueASCII( |
| + chromeos::switches::kConsumerDeviceManagementUrl); |
| + else |
|
Mattias Nissler (ping if slow)
2014/04/24 11:38:12
no need for the else here.
davidyu
2014/04/25 01:45:40
Done.
|
| + return kDefaultConsumerDeviceManagementServerUrl; |
| + } |
| +}; |
| + |
| } // namespace |
| BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS() |
| @@ -110,6 +135,13 @@ void BrowserPolicyConnectorChromeOS::Init( |
| scoped_refptr<net::URLRequestContextGetter> request_context) { |
| ChromeBrowserPolicyConnector::Init(local_state, request_context); |
| + scoped_ptr<DeviceManagementService::Configuration> configuration( |
| + new ConsumerDeviceManagementServiceConfiguration); |
| + 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 |