| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "google_apis/gaia/gaia_auth_util.h" | 58 #include "google_apis/gaia/gaia_auth_util.h" |
| 59 #include "net/url_request/url_request_context_getter.h" | 59 #include "net/url_request/url_request_context_getter.h" |
| 60 | 60 |
| 61 using content::BrowserThread; | 61 using content::BrowserThread; |
| 62 | 62 |
| 63 namespace policy { | 63 namespace policy { |
| 64 | 64 |
| 65 namespace { | 65 namespace { |
| 66 | 66 |
| 67 // Install attributes for tests. | 67 // Install attributes for tests. |
| 68 EnterpriseInstallAttributes* g_testing_install_attributes = NULL; | 68 EnterpriseInstallAttributes* g_testing_install_attributes = nullptr; |
| 69 | 69 |
| 70 // Helper that returns a new SequencedTaskRunner backed by the blocking pool. | 70 // Helper that returns a new SequencedTaskRunner backed by the blocking pool. |
| 71 // Each SequencedTaskRunner returned is independent from the others. | 71 // Each SequencedTaskRunner returned is independent from the others. |
| 72 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { | 72 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { |
| 73 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 73 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
| 74 CHECK(pool); | 74 CHECK(pool); |
| 75 return pool->GetSequencedTaskRunnerWithShutdownBehavior( | 75 return pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 76 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 76 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS() | 81 BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS() |
| 82 : device_cloud_policy_manager_(NULL), | 82 : device_cloud_policy_manager_(nullptr), |
| 83 global_user_cloud_policy_provider_(NULL), | 83 global_user_cloud_policy_provider_(nullptr), |
| 84 weak_ptr_factory_(this) { | 84 weak_ptr_factory_(this) { |
| 85 if (g_testing_install_attributes) { | 85 if (g_testing_install_attributes) { |
| 86 install_attributes_.reset(g_testing_install_attributes); | 86 install_attributes_.reset(g_testing_install_attributes); |
| 87 g_testing_install_attributes = NULL; | 87 g_testing_install_attributes = nullptr; |
| 88 } | 88 } |
| 89 | 89 |
| 90 // SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests. | 90 // SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests. |
| 91 | 91 |
| 92 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready | 92 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready |
| 93 // (removing it now breaks tests). crbug.com/141016. | 93 // (removing it now breaks tests). crbug.com/141016. |
| 94 if (chromeos::SystemSaltGetter::IsInitialized() && | 94 if (chromeos::SystemSaltGetter::IsInitialized() && |
| 95 chromeos::DBusThreadManager::IsInitialized()) { | 95 chromeos::DBusThreadManager::IsInitialized()) { |
| 96 state_keys_broker_.reset(new ServerBackedStateKeysBroker( | 96 state_keys_broker_.reset(new ServerBackedStateKeysBroker( |
| 97 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 97 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 void BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting( | 264 void BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting( |
| 265 EnterpriseInstallAttributes* attributes) { | 265 EnterpriseInstallAttributes* attributes) { |
| 266 DCHECK(!g_testing_install_attributes); | 266 DCHECK(!g_testing_install_attributes); |
| 267 g_testing_install_attributes = attributes; | 267 g_testing_install_attributes = attributes; |
| 268 } | 268 } |
| 269 | 269 |
| 270 // static | 270 // static |
| 271 void BrowserPolicyConnectorChromeOS::RemoveInstallAttributesForTesting() { | 271 void BrowserPolicyConnectorChromeOS::RemoveInstallAttributesForTesting() { |
| 272 if (g_testing_install_attributes) { | 272 if (g_testing_install_attributes) { |
| 273 delete g_testing_install_attributes; | 273 delete g_testing_install_attributes; |
| 274 g_testing_install_attributes = NULL; | 274 g_testing_install_attributes = nullptr; |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 // static | 278 // static |
| 279 void BrowserPolicyConnectorChromeOS::RegisterPrefs( | 279 void BrowserPolicyConnectorChromeOS::RegisterPrefs( |
| 280 PrefRegistrySimple* registry) { | 280 PrefRegistrySimple* registry) { |
| 281 registry->RegisterIntegerPref( | 281 registry->RegisterIntegerPref( |
| 282 prefs::kDevicePolicyRefreshRate, | 282 prefs::kDevicePolicyRefreshRate, |
| 283 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); | 283 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); |
| 284 } | 284 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 device_cloud_policy_manager_->device_store()->policy(); | 344 device_cloud_policy_manager_->device_store()->policy(); |
| 345 if (policy_data) { | 345 if (policy_data) { |
| 346 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(), | 346 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(), |
| 347 policy_data->device_affiliation_ids().end()); | 347 policy_data->device_affiliation_ids().end()); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 return affiliation_ids; | 350 return affiliation_ids; |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace policy | 353 } // namespace policy |
| OLD | NEW |