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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 } | 696 } |
697 | 697 |
698 // DEPRECATED. | 698 // DEPRECATED. |
699 void RetrievePropertyOp::OnKeyOpComplete( | 699 void RetrievePropertyOp::OnKeyOpComplete( |
700 const OwnerManager::KeyOpCode return_code, | 700 const OwnerManager::KeyOpCode return_code, |
701 const std::vector<uint8>& sig) { | 701 const std::vector<uint8>& sig) { |
702 NOTREACHED(); | 702 NOTREACHED(); |
703 } | 703 } |
704 | 704 |
705 std::string RetrievePropertyOp::LookUpInPolicy(const std::string& prop) { | 705 std::string RetrievePropertyOp::LookUpInPolicy(const std::string& prop) { |
| 706 if (prop == kDeviceOwner) { |
| 707 const em::PolicyData& data = service_->cached_policy(); |
| 708 if (data.has_username() && !data.has_request_token()) |
| 709 return data.username(); |
| 710 return ""; |
| 711 } |
706 em::ChromeDeviceSettingsProto pol; | 712 em::ChromeDeviceSettingsProto pol; |
707 pol.ParseFromString(service_->cached_policy().policy_value()); | 713 pol.ParseFromString(service_->cached_policy().policy_value()); |
708 if (prop == kAccountsPrefAllowNewUser) { | 714 if (prop == kAccountsPrefAllowNewUser) { |
709 if (pol.has_allow_new_users() && | 715 if (pol.has_allow_new_users() && |
710 pol.allow_new_users().has_allow_new_users() && | 716 pol.allow_new_users().has_allow_new_users() && |
711 pol.allow_new_users().allow_new_users()) { | 717 pol.allow_new_users().allow_new_users()) { |
712 return kVeritas[1]; // New users allowed, user_whitelist() ignored. | 718 return kVeritas[1]; // New users allowed, user_whitelist() ignored. |
713 } | 719 } |
714 // If we have the allow_new_users bool, and it is true, we honor that above. | 720 // If we have the allow_new_users bool, and it is true, we honor that above. |
715 // In all other cases (don't have it, have it and it is set to false, etc), | 721 // In all other cases (don't have it, have it and it is set to false, etc), |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); | 926 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); |
921 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); | 927 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); |
922 } | 928 } |
923 | 929 |
924 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, | 930 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, |
925 const em::PolicyFetchResponse& value) { | 931 const em::PolicyFetchResponse& value) { |
926 d_->OnSettingsOpCompleted(code, value); | 932 d_->OnSettingsOpCompleted(code, value); |
927 } | 933 } |
928 | 934 |
929 } // namespace chromeos | 935 } // namespace chromeos |
OLD | NEW |