Chromium Code Reviews| Index: chrome/browser/policy/device_policy_cache.cc |
| diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc |
| index f972779342d4f73d8e8c90b75954915fd4137945..8be6450fb0f3de3f3a58d7716931fd225ba06483 100644 |
| --- a/chrome/browser/policy/device_policy_cache.cc |
| +++ b/chrome/browser/policy/device_policy_cache.cc |
| @@ -15,7 +15,7 @@ |
| #include "chrome/browser/chromeos/login/ownership_service.h" |
| #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| #include "chrome/browser/policy/configuration_policy_pref_store.h" |
|
Joao da Silva
2011/07/06 16:45:14
Nit: configuration_policy_pref_store.h not used
gfeher
2011/07/07 13:51:00
Done.
|
| -#include "chrome/browser/policy/device_policy_identity_strategy.h" |
| +#include "chrome/browser/policy/cloud_policy_data.h" |
| #include "chrome/browser/policy/enterprise_install_attributes.h" |
| #include "chrome/browser/policy/policy_map.h" |
| #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| @@ -111,9 +111,9 @@ Value* DecodeIntegerValue(google::protobuf::int64 value) { |
| namespace policy { |
| DevicePolicyCache::DevicePolicyCache( |
| - DevicePolicyIdentityStrategy* identity_strategy, |
| + CloudPolicyData* data, |
| EnterpriseInstallAttributes* install_attributes) |
| - : identity_strategy_(identity_strategy), |
| + : data_(data), |
| install_attributes_(install_attributes), |
| signed_settings_helper_(chromeos::SignedSettingsHelper::Get()), |
| starting_up_(true), |
| @@ -121,10 +121,10 @@ DevicePolicyCache::DevicePolicyCache( |
| } |
| DevicePolicyCache::DevicePolicyCache( |
| - DevicePolicyIdentityStrategy* identity_strategy, |
| + CloudPolicyData* data, |
| EnterpriseInstallAttributes* install_attributes, |
| chromeos::SignedSettingsHelper* signed_settings_helper) |
| - : identity_strategy_(identity_strategy), |
| + : data_(data), |
| install_attributes_(install_attributes), |
| signed_settings_helper_(signed_settings_helper), |
| starting_up_(true), |
| @@ -192,11 +192,15 @@ void DevicePolicyCache::OnRetrievePolicyCompleted( |
| DCHECK(CalledOnValidThread()); |
| if (starting_up_) { |
| starting_up_ = false; |
| + // All the code pathes should issue a data_->SetDeviceToken(..., true) |
|
Joao da Silva
2011/07/06 16:45:14
Nit: pathes -> paths
gfeher
2011/07/07 13:51:00
Done.
|
| + // to signal that the cache has finished loading, so other components |
| + // are free to modify token data. |
| if (code == chromeos::SignedSettings::NOT_FOUND || |
| code == chromeos::SignedSettings::KEY_UNAVAILABLE || |
| !policy.has_policy_data()) { |
| InformNotifier(CloudPolicySubsystem::UNENROLLED, |
| CloudPolicySubsystem::NO_DETAILS); |
| + data_->SetDeviceToken("", true); |
| return; |
| } |
| em::PolicyData policy_data; |
| @@ -204,6 +208,7 @@ void DevicePolicyCache::OnRetrievePolicyCompleted( |
| LOG(WARNING) << "Failed to parse PolicyData protobuf."; |
| InformNotifier(CloudPolicySubsystem::LOCAL_ERROR, |
| CloudPolicySubsystem::POLICY_LOCAL_ERROR); |
| + data_->SetDeviceToken("", true); |
| return; |
| } |
| if (!policy_data.has_request_token() || |
| @@ -214,17 +219,18 @@ void DevicePolicyCache::OnRetrievePolicyCompleted( |
| // TODO(jkummerow): Reminder: When we want to feed device-wide settings |
|
pastarmovj
2011/07/06 12:11:57
Is this todo still relevant?
gfeher
2011/07/06 15:14:20
TODO(gfeher): investigate more and discuss with Ma
|
| // made by a local owner into this cache, we need to call |
| // SetPolicyInternal() here. |
| + data_->SetDeviceToken("", true); |
| return; |
| } |
| if (!policy_data.has_username() || !policy_data.has_device_id()) { |
| InformNotifier(CloudPolicySubsystem::LOCAL_ERROR, |
| CloudPolicySubsystem::POLICY_LOCAL_ERROR); |
| + data_->SetDeviceToken("", true); |
| return; |
| } |
| - identity_strategy_->SetDeviceManagementCredentials( |
| - policy_data.username(), |
| - policy_data.device_id(), |
| - policy_data.request_token()); |
| + data_->set_user_name(policy_data.username()); |
| + data_->set_device_id(policy_data.device_id()); |
| + data_->SetDeviceToken(policy_data.request_token(), true); |
| SetPolicyInternal(policy, NULL, false); |
| } else { // In other words, starting_up_ == false. |
| if (code != chromeos::SignedSettings::SUCCESS) { |