| 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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 payload.end())); | 838 payload.end())); |
| 839 RequestStorePolicy(); | 839 RequestStorePolicy(); |
| 840 return; | 840 return; |
| 841 } | 841 } |
| 842 Fail(SignedSettings::MapKeyOpCode(return_code)); | 842 Fail(SignedSettings::MapKeyOpCode(return_code)); |
| 843 } | 843 } |
| 844 | 844 |
| 845 void StorePolicyOp::RequestStorePolicy() { | 845 void StorePolicyOp::RequestStorePolicy() { |
| 846 std::string serialized; | 846 std::string serialized; |
| 847 if (policy_->SerializeToString(&serialized)) { | 847 if (policy_->SerializeToString(&serialized)) { |
| 848 DBusThreadManager::Get()->session_manager_client()->StorePolicy( | 848 DBusThreadManager::Get()->GetSessionManagerClient()->StorePolicy( |
| 849 serialized, | 849 serialized, |
| 850 base::Bind(&StorePolicyOp::OnBoolComplete, this)); | 850 base::Bind(&StorePolicyOp::OnBoolComplete, this)); |
| 851 } else { | 851 } else { |
| 852 Fail(OPERATION_FAILED); | 852 Fail(OPERATION_FAILED); |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 | 855 |
| 856 void StorePolicyOp::PerformCallback(SignedSettings::ReturnCode code, | 856 void StorePolicyOp::PerformCallback(SignedSettings::ReturnCode code, |
| 857 bool value) { | 857 bool value) { |
| 858 d_->OnSettingsOpCompleted(code, value); | 858 d_->OnSettingsOpCompleted(code, value); |
| 859 } | 859 } |
| 860 | 860 |
| 861 RetrievePolicyOp::RetrievePolicyOp( | 861 RetrievePolicyOp::RetrievePolicyOp( |
| 862 SignedSettings::Delegate<const em::PolicyFetchResponse&>* d) | 862 SignedSettings::Delegate<const em::PolicyFetchResponse&>* d) |
| 863 : d_(d) { | 863 : d_(d) { |
| 864 } | 864 } |
| 865 | 865 |
| 866 RetrievePolicyOp::~RetrievePolicyOp() {} | 866 RetrievePolicyOp::~RetrievePolicyOp() {} |
| 867 | 867 |
| 868 void RetrievePolicyOp::Execute() { | 868 void RetrievePolicyOp::Execute() { |
| 869 DBusThreadManager::Get()->session_manager_client()->RetrievePolicy( | 869 DBusThreadManager::Get()->GetSessionManagerClient()->RetrievePolicy( |
| 870 base::Bind(&RetrievePolicyOp::OnStringComplete, this)); | 870 base::Bind(&RetrievePolicyOp::OnStringComplete, this)); |
| 871 } | 871 } |
| 872 | 872 |
| 873 void RetrievePolicyOp::Fail(SignedSettings::ReturnCode code) { | 873 void RetrievePolicyOp::Fail(SignedSettings::ReturnCode code) { |
| 874 VLOG(2) << "RetrievePolicyOp::Execute() failed with " << code; | 874 VLOG(2) << "RetrievePolicyOp::Execute() failed with " << code; |
| 875 BrowserThread::PostTask( | 875 BrowserThread::PostTask( |
| 876 BrowserThread::UI, FROM_HERE, | 876 BrowserThread::UI, FROM_HERE, |
| 877 base::Bind(&RetrievePolicyOp::PerformCallback, this, code, | 877 base::Bind(&RetrievePolicyOp::PerformCallback, this, code, |
| 878 em::PolicyFetchResponse())); | 878 em::PolicyFetchResponse())); |
| 879 } | 879 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); | 930 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); |
| 931 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); | 931 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); |
| 932 } | 932 } |
| 933 | 933 |
| 934 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, | 934 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, |
| 935 const em::PolicyFetchResponse& value) { | 935 const em::PolicyFetchResponse& value) { |
| 936 d_->OnSettingsOpCompleted(code, value); | 936 d_->OnSettingsOpCompleted(code, value); |
| 937 } | 937 } |
| 938 | 938 |
| 939 } // namespace chromeos | 939 } // namespace chromeos |
| OLD | NEW |