| 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 void BrowserPolicyConnector::InitializeDevicePolicy() { | 526 void BrowserPolicyConnector::InitializeDevicePolicy() { |
| 527 #if defined(OS_CHROMEOS) | 527 #if defined(OS_CHROMEOS) |
| 528 // Throw away the old backend. | 528 // Throw away the old backend. |
| 529 device_cloud_policy_subsystem_.reset(); | 529 device_cloud_policy_subsystem_.reset(); |
| 530 device_data_store_.reset(); | 530 device_data_store_.reset(); |
| 531 | 531 |
| 532 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 532 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 533 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { | 533 if (command_line->HasSwitch(switches::kEnableCloudPolicyService)) { |
| 534 if (command_line->HasSwitch(switches::kEnableCloudPolicyService)) { | 534 // TODO(mnissler): Initialize new-style device policy here once it's |
| 535 // TODO(mnissler): Initialize new-style device policy here once it's | 535 // implemented. |
| 536 // implemented. | 536 } else { |
| 537 } else { | 537 device_data_store_.reset(CloudPolicyDataStore::CreateForDevicePolicies()); |
| 538 device_data_store_.reset(CloudPolicyDataStore::CreateForDevicePolicies()); | 538 chromeos::CryptohomeLibrary* cryptohome = |
| 539 chromeos::CryptohomeLibrary* cryptohome = | 539 chromeos::CrosLibrary::Get()->GetCryptohomeLibrary(); |
| 540 chromeos::CrosLibrary::Get()->GetCryptohomeLibrary(); | 540 install_attributes_.reset(new EnterpriseInstallAttributes(cryptohome)); |
| 541 install_attributes_.reset(new EnterpriseInstallAttributes(cryptohome)); | 541 DevicePolicyCache* device_policy_cache = |
| 542 DevicePolicyCache* device_policy_cache = | 542 new DevicePolicyCache(device_data_store_.get(), |
| 543 new DevicePolicyCache(device_data_store_.get(), | 543 install_attributes_.get()); |
| 544 install_attributes_.get()); | |
| 545 | 544 |
| 546 managed_cloud_provider_->SetDevicePolicyCache(device_policy_cache); | 545 managed_cloud_provider_->SetDevicePolicyCache(device_policy_cache); |
| 547 recommended_cloud_provider_->SetDevicePolicyCache(device_policy_cache); | 546 recommended_cloud_provider_->SetDevicePolicyCache(device_policy_cache); |
| 548 | 547 |
| 549 device_cloud_policy_subsystem_.reset(new CloudPolicySubsystem( | 548 device_cloud_policy_subsystem_.reset(new CloudPolicySubsystem( |
| 550 device_data_store_.get(), | 549 device_data_store_.get(), |
| 551 device_policy_cache, | 550 device_policy_cache, |
| 552 GetDeviceManagementUrl())); | 551 GetDeviceManagementUrl())); |
| 553 } | |
| 554 } | 552 } |
| 555 #endif | 553 #endif |
| 556 } | 554 } |
| 557 | 555 |
| 558 void BrowserPolicyConnector::CompleteInitialization() { | 556 void BrowserPolicyConnector::CompleteInitialization() { |
| 559 #if defined(OS_CHROMEOS) | 557 #if defined(OS_CHROMEOS) |
| 560 | 558 |
| 561 // Create the AppPackUpdater to start updating the cache. It requires the | 559 // Create the AppPackUpdater to start updating the cache. It requires the |
| 562 // system request context, which isn't available in Init(); therefore it is | 560 // system request context, which isn't available in Init(); therefore it is |
| 563 // created only once the loops are running. | 561 // created only once the loops are running. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 return new AsyncPolicyProvider(loader.Pass()); | 640 return new AsyncPolicyProvider(loader.Pass()); |
| 643 } else { | 641 } else { |
| 644 return NULL; | 642 return NULL; |
| 645 } | 643 } |
| 646 #else | 644 #else |
| 647 return NULL; | 645 return NULL; |
| 648 #endif | 646 #endif |
| 649 } | 647 } |
| 650 | 648 |
| 651 } // namespace policy | 649 } // namespace policy |
| OLD | NEW |