| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Helper that returns a new SequencedTaskRunner backed by the blocking pool. | 67 // Helper that returns a new SequencedTaskRunner backed by the blocking pool. |
| 68 // Each SequencedTaskRunner returned is independent from the others. | 68 // Each SequencedTaskRunner returned is independent from the others. |
| 69 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { | 69 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { |
| 70 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 70 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
| 71 CHECK(pool); | 71 CHECK(pool); |
| 72 return pool->GetSequencedTaskRunnerWithShutdownBehavior( | 72 return pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 73 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 73 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 74 } | 74 } |
| 75 | 75 |
| 76 std::string GetDeviceManagementServerUrlForConsumer() { | 76 std::string GetDeviceManagementServerUrlForConsumer() { |
| 77 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 77 const base::CommandLine* command_line = |
| 78 base::CommandLine::ForCurrentProcess(); |
| 78 if (command_line->HasSwitch( | 79 if (command_line->HasSwitch( |
| 79 chromeos::switches::kConsumerDeviceManagementUrl)) { | 80 chromeos::switches::kConsumerDeviceManagementUrl)) { |
| 80 return command_line->GetSwitchValueASCII( | 81 return command_line->GetSwitchValueASCII( |
| 81 chromeos::switches::kConsumerDeviceManagementUrl); | 82 chromeos::switches::kConsumerDeviceManagementUrl); |
| 82 } | 83 } |
| 83 return kDefaultConsumerDeviceManagementServerUrl; | 84 return kDefaultConsumerDeviceManagementServerUrl; |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace | 87 } // namespace |
| 87 | 88 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 108 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); | 109 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); |
| 109 if (!install_attributes_) { | 110 if (!install_attributes_) { |
| 110 install_attributes_.reset( | 111 install_attributes_.reset( |
| 111 new EnterpriseInstallAttributes(cryptohome_client)); | 112 new EnterpriseInstallAttributes(cryptohome_client)); |
| 112 } | 113 } |
| 113 base::FilePath install_attrs_file; | 114 base::FilePath install_attrs_file; |
| 114 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, | 115 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, |
| 115 &install_attrs_file)); | 116 &install_attrs_file)); |
| 116 install_attributes_->ReadCacheFile(install_attrs_file); | 117 install_attributes_->ReadCacheFile(install_attrs_file); |
| 117 | 118 |
| 118 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 119 const base::CommandLine* command_line = |
| 120 base::CommandLine::ForCurrentProcess(); |
| 119 if (command_line->HasSwitch( | 121 if (command_line->HasSwitch( |
| 120 chromeos::switches::kEnableConsumerManagement)) { | 122 chromeos::switches::kEnableConsumerManagement)) { |
| 121 consumer_management_service_.reset( | 123 consumer_management_service_.reset( |
| 122 new ConsumerManagementService( | 124 new ConsumerManagementService( |
| 123 cryptohome_client, | 125 cryptohome_client, |
| 124 chromeos::DeviceSettingsService::Get())); | 126 chromeos::DeviceSettingsService::Get())); |
| 125 } | 127 } |
| 126 | 128 |
| 127 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( | 129 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( |
| 128 new DeviceCloudPolicyStoreChromeOS( | 130 new DeviceCloudPolicyStoreChromeOS( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 142 global_user_cloud_policy_provider_)); | 144 global_user_cloud_policy_provider_)); |
| 143 } | 145 } |
| 144 | 146 |
| 145 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} | 147 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} |
| 146 | 148 |
| 147 void BrowserPolicyConnectorChromeOS::Init( | 149 void BrowserPolicyConnectorChromeOS::Init( |
| 148 PrefService* local_state, | 150 PrefService* local_state, |
| 149 scoped_refptr<net::URLRequestContextGetter> request_context) { | 151 scoped_refptr<net::URLRequestContextGetter> request_context) { |
| 150 ChromeBrowserPolicyConnector::Init(local_state, request_context); | 152 ChromeBrowserPolicyConnector::Init(local_state, request_context); |
| 151 | 153 |
| 152 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 154 const base::CommandLine* command_line = |
| 155 base::CommandLine::ForCurrentProcess(); |
| 153 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { | 156 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { |
| 154 scoped_ptr<DeviceManagementService::Configuration> configuration( | 157 scoped_ptr<DeviceManagementService::Configuration> configuration( |
| 155 new DeviceManagementServiceConfiguration( | 158 new DeviceManagementServiceConfiguration( |
| 156 GetDeviceManagementServerUrlForConsumer())); | 159 GetDeviceManagementServerUrlForConsumer())); |
| 157 consumer_device_management_service_.reset( | 160 consumer_device_management_service_.reset( |
| 158 new DeviceManagementService(configuration.Pass())); | 161 new DeviceManagementService(configuration.Pass())); |
| 159 consumer_device_management_service_->ScheduleInitialization( | 162 consumer_device_management_service_->ScheduleInitialization( |
| 160 kServiceInitializationStartupDelay); | 163 kServiceInitializationStartupDelay); |
| 161 } | 164 } |
| 162 | 165 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 std::string timezone; | 338 std::string timezone; |
| 336 if (chromeos::CrosSettings::Get()->GetString(chromeos::kSystemTimezonePolicy, | 339 if (chromeos::CrosSettings::Get()->GetString(chromeos::kSystemTimezonePolicy, |
| 337 &timezone) && | 340 &timezone) && |
| 338 !timezone.empty()) { | 341 !timezone.empty()) { |
| 339 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 342 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 340 base::UTF8ToUTF16(timezone)); | 343 base::UTF8ToUTF16(timezone)); |
| 341 } | 344 } |
| 342 } | 345 } |
| 343 | 346 |
| 344 } // namespace policy | 347 } // namespace policy |
| OLD | NEW |