| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/login/signed_settings.h" | 5 #include "chrome/browser/chromeos/login/signed_settings.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 CheckWhitelistOp::CheckWhitelistOp(const std::string& email, | 328 CheckWhitelistOp::CheckWhitelistOp(const std::string& email, |
| 329 SignedSettings::Delegate<bool>* d) | 329 SignedSettings::Delegate<bool>* d) |
| 330 : email_(email), | 330 : email_(email), |
| 331 d_(d) { | 331 d_(d) { |
| 332 } | 332 } |
| 333 | 333 |
| 334 CheckWhitelistOp::~CheckWhitelistOp() {} | 334 CheckWhitelistOp::~CheckWhitelistOp() {} |
| 335 | 335 |
| 336 void CheckWhitelistOp::Execute() { | 336 void CheckWhitelistOp::Execute() { |
| 337 CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded()); | |
| 338 std::vector<uint8> sig; | 337 std::vector<uint8> sig; |
| 339 std::string email_to_check = email_; | 338 std::string email_to_check = email_; |
| 340 if (!service_->has_cached_policy()) { | 339 if (!service_->has_cached_policy()) { |
| 341 TryToFetchPolicyAndCallBack(); | 340 TryToFetchPolicyAndCallBack(); |
| 342 return; | 341 return; |
| 343 } | 342 } |
| 344 if (LookUpInPolicy(email_to_check)) { | 343 if (LookUpInPolicy(email_to_check)) { |
| 345 VLOG(2) << "Whitelist check was successful for " << email_to_check; | 344 VLOG(2) << "Whitelist check was successful for " << email_to_check; |
| 346 Succeed(true); | 345 Succeed(true); |
| 347 return; | 346 return; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 647 |
| 649 RetrievePropertyOp::RetrievePropertyOp(const std::string& name, | 648 RetrievePropertyOp::RetrievePropertyOp(const std::string& name, |
| 650 SignedSettings::Delegate<std::string>* d) | 649 SignedSettings::Delegate<std::string>* d) |
| 651 : name_(name), | 650 : name_(name), |
| 652 d_(d) { | 651 d_(d) { |
| 653 } | 652 } |
| 654 | 653 |
| 655 RetrievePropertyOp::~RetrievePropertyOp() {} | 654 RetrievePropertyOp::~RetrievePropertyOp() {} |
| 656 | 655 |
| 657 void RetrievePropertyOp::Execute() { | 656 void RetrievePropertyOp::Execute() { |
| 658 CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded()); | |
| 659 // TODO(dilmah): Fix the race: | 657 // TODO(dilmah): Fix the race: |
| 660 // At the moment when device becomes owned there is lapse of time after | 658 // At the moment when device becomes owned there is lapse of time after |
| 661 // device has been owned and before temp_storage settings are finally | 659 // device has been owned and before temp_storage settings are finally |
| 662 // persisted into signed settings. | 660 // persisted into signed settings. |
| 663 // In this lapse of time Retrieve loses access to those settings. | 661 // In this lapse of time Retrieve loses access to those settings. |
| 664 if (service_->GetStatus(true) != OwnershipService::OWNERSHIP_TAKEN) { | 662 if (service_->GetStatus(true) != OwnershipService::OWNERSHIP_TAKEN) { |
| 665 if (g_browser_process && | 663 if (g_browser_process && |
| 666 g_browser_process->local_state() && | 664 g_browser_process->local_state() && |
| 667 SignedSettingsTempStorage::Retrieve( | 665 SignedSettingsTempStorage::Retrieve( |
| 668 name_, &value_, g_browser_process->local_state())) { | 666 name_, &value_, g_browser_process->local_state())) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); | 929 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); |
| 932 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); | 930 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); |
| 933 } | 931 } |
| 934 | 932 |
| 935 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, | 933 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, |
| 936 const em::PolicyFetchResponse& value) { | 934 const em::PolicyFetchResponse& value) { |
| 937 d_->OnSettingsOpCompleted(code, value); | 935 d_->OnSettingsOpCompleted(code, value); |
| 938 } | 936 } |
| 939 | 937 |
| 940 } // namespace chromeos | 938 } // namespace chromeos |
| OLD | NEW |