| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ownership/owner_settings_service_chromeos.h" | 5 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 using ownership::OwnerKeyUtil; | 40 using ownership::OwnerKeyUtil; |
| 41 using ownership::PrivateKey; | 41 using ownership::PrivateKey; |
| 42 using ownership::PublicKey; | 42 using ownership::PublicKey; |
| 43 | 43 |
| 44 namespace chromeos { | 44 namespace chromeos { |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 bool IsOwnerInTests(const std::string& user_id) { | 48 bool IsOwnerInTests(const std::string& user_id) { |
| 49 if (user_id.empty() || | 49 if (user_id.empty() || |
| 50 !CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType) || | 50 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 51 ::switches::kTestType) || |
| 51 !CrosSettings::IsInitialized()) { | 52 !CrosSettings::IsInitialized()) { |
| 52 return false; | 53 return false; |
| 53 } | 54 } |
| 54 const base::Value* value = CrosSettings::Get()->GetPref(kDeviceOwner); | 55 const base::Value* value = CrosSettings::Get()->GetPref(kDeviceOwner); |
| 55 if (!value || value->GetType() != base::Value::TYPE_STRING) | 56 if (!value || value->GetType() != base::Value::TYPE_STRING) |
| 56 return false; | 57 return false; |
| 57 return static_cast<const base::StringValue*>(value)->GetString() == user_id; | 58 return static_cast<const base::StringValue*>(value)->GetString() == user_id; |
| 58 } | 59 } |
| 59 | 60 |
| 60 void LoadPrivateKeyByPublicKey( | 61 void LoadPrivateKeyByPublicKey( |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 std::vector<OnManagementSettingsSetCallback> callbacks; | 723 std::vector<OnManagementSettingsSetCallback> callbacks; |
| 723 pending_management_settings_callbacks_.swap(callbacks); | 724 pending_management_settings_callbacks_.swap(callbacks); |
| 724 for (const auto& callback : callbacks) { | 725 for (const auto& callback : callbacks) { |
| 725 if (!callback.is_null()) | 726 if (!callback.is_null()) |
| 726 callback.Run(success); | 727 callback.Run(success); |
| 727 } | 728 } |
| 728 StorePendingChanges(); | 729 StorePendingChanges(); |
| 729 } | 730 } |
| 730 | 731 |
| 731 } // namespace chromeos | 732 } // namespace chromeos |
| OLD | NEW |