OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/policy/cloud/cloud_policy_service.h" | 21 #include "chrome/browser/policy/cloud/cloud_policy_service.h" |
22 #include "chrome/browser/policy/cloud/device_management_service.h" | 22 #include "chrome/browser/policy/cloud/device_management_service.h" |
23 #include "chrome/browser/policy/configuration_policy_provider.h" | 23 #include "chrome/browser/policy/configuration_policy_provider.h" |
24 #include "chrome/browser/policy/managed_mode_policy_provider.h" | 24 #include "chrome/browser/policy/managed_mode_policy_provider.h" |
25 #include "chrome/browser/policy/policy_service_impl.h" | 25 #include "chrome/browser/policy/policy_service_impl.h" |
26 #include "chrome/browser/policy/policy_statistics_collector.h" | 26 #include "chrome/browser/policy/policy_statistics_collector.h" |
27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 31 #include "components/user_prefs/pref_registry_syncable.h" |
31 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
32 #include "google_apis/gaia/gaia_auth_util.h" | 33 #include "google_apis/gaia/gaia_auth_util.h" |
33 #include "google_apis/gaia/gaia_constants.h" | 34 #include "google_apis/gaia/gaia_constants.h" |
34 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
35 #include "net/url_request/url_request_context_getter.h" | 36 #include "net/url_request/url_request_context_getter.h" |
36 #include "policy/policy_constants.h" | 37 #include "policy/policy_constants.h" |
37 #include "third_party/icu/public/i18n/unicode/regex.h" | 38 #include "third_party/icu/public/i18n/unicode/regex.h" |
38 | 39 |
39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
40 #include "chrome/browser/policy/policy_loader_win.h" | 41 #include "chrome/browser/policy/policy_loader_win.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // call SetPolicyProviderForTesting() again. It is still owned by the test. | 225 // call SetPolicyProviderForTesting() again. It is still owned by the test. |
225 g_testing_provider = NULL; | 226 g_testing_provider = NULL; |
226 if (platform_provider_) | 227 if (platform_provider_) |
227 platform_provider_->Shutdown(); | 228 platform_provider_->Shutdown(); |
228 | 229 |
229 #if defined(OS_CHROMEOS) | 230 #if defined(OS_CHROMEOS) |
230 // The AppPackUpdater may be observing the |device_cloud_policy_subsystem_|. | 231 // The AppPackUpdater may be observing the |device_cloud_policy_subsystem_|. |
231 // Delete it first. | 232 // Delete it first. |
232 app_pack_updater_.reset(); | 233 app_pack_updater_.reset(); |
233 | 234 |
| 235 network_configuration_updater_.reset(); |
| 236 |
234 if (device_cloud_policy_manager_) | 237 if (device_cloud_policy_manager_) |
235 device_cloud_policy_manager_->Shutdown(); | 238 device_cloud_policy_manager_->Shutdown(); |
236 if (device_local_account_policy_provider_) | 239 if (device_local_account_policy_provider_) |
237 device_local_account_policy_provider_->Shutdown(); | 240 device_local_account_policy_provider_->Shutdown(); |
238 if (device_local_account_policy_service_) | 241 if (device_local_account_policy_service_) |
239 device_local_account_policy_service_->Disconnect(); | 242 device_local_account_policy_service_->Disconnect(); |
240 if (user_cloud_policy_manager_) | 243 if (user_cloud_policy_manager_) |
241 user_cloud_policy_manager_->Shutdown(); | 244 user_cloud_policy_manager_->Shutdown(); |
242 global_user_cloud_policy_provider_.Shutdown(); | 245 global_user_cloud_policy_provider_.Shutdown(); |
243 #endif | 246 #endif |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 UTF8ToUTF16(gaia::ExtractDomainName(gaia::CanonicalizeEmail(username))); | 469 UTF8ToUTF16(gaia::ExtractDomainName(gaia::CanonicalizeEmail(username))); |
467 for (size_t i = 0; i < arraysize(kNonManagedDomainPatterns); i++) { | 470 for (size_t i = 0; i < arraysize(kNonManagedDomainPatterns); i++) { |
468 string16 pattern = WideToUTF16(kNonManagedDomainPatterns[i]); | 471 string16 pattern = WideToUTF16(kNonManagedDomainPatterns[i]); |
469 if (MatchDomain(domain, pattern)) | 472 if (MatchDomain(domain, pattern)) |
470 return true; | 473 return true; |
471 } | 474 } |
472 return false; | 475 return false; |
473 } | 476 } |
474 | 477 |
475 // static | 478 // static |
| 479 bool BrowserPolicyConnector::UsedPolicyCertificates(Profile* profile) { |
| 480 #if defined(OS_CHROMEOS) |
| 481 if (profile->GetPrefs()->GetBoolean(prefs::kUsedPolicyCertificatesOnce)) |
| 482 return true; |
| 483 #endif |
| 484 return false; |
| 485 } |
| 486 |
| 487 // static |
476 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { | 488 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { |
477 registry->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, | 489 registry->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, |
478 kDefaultPolicyRefreshRateMs); | 490 kDefaultPolicyRefreshRateMs); |
479 #if defined(OS_CHROMEOS) | 491 #if defined(OS_CHROMEOS) |
480 registry->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, | 492 registry->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, |
481 kDefaultPolicyRefreshRateMs); | 493 kDefaultPolicyRefreshRateMs); |
482 #endif | 494 #endif |
483 } | 495 } |
484 | 496 |
| 497 // static |
| 498 void BrowserPolicyConnector::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 499 #if defined(OS_CHROMEOS) |
| 500 registry->RegisterBooleanPref(prefs::kUsedPolicyCertificatesOnce, |
| 501 false, |
| 502 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 503 #endif |
| 504 } |
| 505 |
485 void BrowserPolicyConnector::SetTimezoneIfPolicyAvailable() { | 506 void BrowserPolicyConnector::SetTimezoneIfPolicyAvailable() { |
486 #if defined(OS_CHROMEOS) | 507 #if defined(OS_CHROMEOS) |
487 typedef chromeos::CrosSettingsProvider Provider; | 508 typedef chromeos::CrosSettingsProvider Provider; |
488 Provider::TrustedStatus result = | 509 Provider::TrustedStatus result = |
489 chromeos::CrosSettings::Get()->PrepareTrustedValues( | 510 chromeos::CrosSettings::Get()->PrepareTrustedValues( |
490 base::Bind(&BrowserPolicyConnector::SetTimezoneIfPolicyAvailable, | 511 base::Bind(&BrowserPolicyConnector::SetTimezoneIfPolicyAvailable, |
491 weak_ptr_factory_.GetWeakPtr())); | 512 weak_ptr_factory_.GetWeakPtr())); |
492 | 513 |
493 if (result != Provider::TRUSTED) | 514 if (result != Provider::TRUSTED) |
494 return; | 515 return; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 return new AsyncPolicyProvider(loader.Pass()); | 573 return new AsyncPolicyProvider(loader.Pass()); |
553 } else { | 574 } else { |
554 return NULL; | 575 return NULL; |
555 } | 576 } |
556 #else | 577 #else |
557 return NULL; | 578 return NULL; |
558 #endif | 579 #endif |
559 } | 580 } |
560 | 581 |
561 } // namespace policy | 582 } // namespace policy |
OLD | NEW |