Chromium Code Reviews| Index: chrome/browser/chromeos/login/signed_settings_cache.cc |
| diff --git a/chrome/browser/chromeos/login/signed_settings_cache.cc b/chrome/browser/chromeos/login/signed_settings_cache.cc |
| index 5e0dec19bc32be1be5f0fb4768ea8496bebfbcdc..75e7bbdacf1b944cef3167a72a9b159f3278a3e8 100644 |
| --- a/chrome/browser/chromeos/login/signed_settings_cache.cc |
| +++ b/chrome/browser/chromeos/login/signed_settings_cache.cc |
| @@ -9,81 +9,14 @@ |
| #include "base/base64.h" |
| #include "base/bind.h" |
| #include "chrome/browser/chromeos/cros_settings.h" |
| -#include "chrome/browser/chromeos/login/ownership_service.h" |
| -#include "chrome/browser/chromeos/login/signed_settings_helper.h" |
| #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/common/pref_names.h" |
| -using content::BrowserThread; |
| - |
| namespace em = enterprise_management; |
| namespace chromeos { |
| -namespace { |
| - |
| -void OnStorePolicyCompleted(SignedSettings::ReturnCode code) { |
|
pastarmovj
2012/07/30 13:55:02
2 tests come to my mind to verify that this here w
Mattias Nissler (ping if slow)
2012/08/02 12:01:52
I confirmed that both the cache and migration work
|
| - if (code != SignedSettings::SUCCESS) |
| - LOG(ERROR) << "Couldn't save temp store to the policy blob. code: " << code; |
| - else |
| - CrosSettings::Get()->ReloadProviders(); |
| -} |
| - |
| -void FinishFinalize(PrefService* local_state, |
| - SignedSettings::ReturnCode code, |
| - const em::PolicyFetchResponse& policy) { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - |
| - if (code != SignedSettings::SUCCESS) { |
| - LOG(ERROR) << "Can't finalize temp store error code:" << code; |
| - return; |
| - } |
| - |
| - if (local_state) { |
| - std::string encoded = |
| - local_state->GetString(prefs::kSignedSettingsCache); |
| - std::string policy_string; |
| - if (!base::Base64Decode(encoded, &policy_string)) { |
| - LOG(ERROR) << "Can't decode policy from base64 on finalizing."; |
| - return; |
| - } |
| - |
| - em::PolicyData merging_policy_data; |
| - if (!merging_policy_data.ParseFromString(policy_string)) { |
| - LOG(ERROR) << "Can't decode policy from string on finalizing."; |
| - return; |
| - } |
| - |
| - em::PolicyFetchResponse policy_envelope = policy; |
| - DCHECK(policy_envelope.has_policy_data()); |
| - em::PolicyData base_policy_data; |
| - base_policy_data.ParseFromString(policy_envelope.policy_data()); |
| - // Merge only the policy value as we should never ever rewrite the other |
| - // fields of the PolicyData protobuf. |
| - base_policy_data.set_policy_value(merging_policy_data.policy_value()); |
| - policy_envelope.set_policy_data(base_policy_data.SerializeAsString()); |
| - DCHECK(base_policy_data.has_username()); |
| - policy_envelope.clear_policy_data_signature(); |
| - SignedSettingsHelper::Get()->StartStorePolicyOp( |
| - policy_envelope, base::Bind(&OnStorePolicyCompleted)); |
| - } |
| -} |
| - |
| -// Reload the initial policy blob, and if successful apply the settings from |
| -// temp storage, and write them back the blob in FinishFinalize. |
| -void ReloadSignedSettingsAndFinalize( |
| - PrefService* local_state, |
| - OwnershipService::Status status, |
| - bool current_user_is_owner) { |
| - if (current_user_is_owner) { |
| - SignedSettingsHelper::Get()->StartRetrievePolicyOp( |
| - base::Bind(FinishFinalize, local_state)); |
| - } |
| -} |
| - |
| -} // namespace |
| - |
| namespace signed_settings_cache { |
| void RegisterPrefs(PrefService* local_state) { |
| @@ -121,13 +54,6 @@ bool Retrieve(em::PolicyData *policy, PrefService* local_state) { |
| return false; |
| } |
| -void Finalize(PrefService* local_state) { |
| - // First we have to make sure the owner is really logged in because the key |
| - // notification is generated on every cloud policy key rotation too. |
| - OwnershipService::GetSharedInstance()->GetStatusAsync( |
| - base::Bind(&ReloadSignedSettingsAndFinalize, local_state)); |
| -} |
| - |
| } // namespace signed_settings_cache |
| } // namespace chromeos |