OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "remoting/host/pairing_registry_delegate_linux.h" | 5 #include "remoting/host/pairing_registry_delegate_linux.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
10 #include "base/files/important_file_writer.h" | 12 #include "base/files/important_file_writer.h" |
11 #include "base/json/json_file_value_serializer.h" | 13 #include "base/json/json_file_value_serializer.h" |
12 #include "base/json/json_string_value_serializer.h" | 14 #include "base/json/json_string_value_serializer.h" |
13 #include "base/location.h" | 15 #include "base/location.h" |
14 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
15 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
16 #include "base/values.h" | 18 #include "base/values.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 int error_code; | 53 int error_code; |
52 std::string error_message; | 54 std::string error_message; |
53 std::unique_ptr<base::Value> pairing_json = | 55 std::unique_ptr<base::Value> pairing_json = |
54 deserializer.Deserialize(&error_code, &error_message); | 56 deserializer.Deserialize(&error_code, &error_message); |
55 if (!pairing_json) { | 57 if (!pairing_json) { |
56 LOG(WARNING) << "Failed to load '" << pairing_file.value() << "' (" | 58 LOG(WARNING) << "Failed to load '" << pairing_file.value() << "' (" |
57 << error_code << ")."; | 59 << error_code << ")."; |
58 continue; | 60 continue; |
59 } | 61 } |
60 | 62 |
61 pairings->Append(pairing_json.release()); | 63 pairings->Append(std::move(pairing_json)); |
62 } | 64 } |
63 | 65 |
64 return pairings; | 66 return pairings; |
65 } | 67 } |
66 | 68 |
67 bool PairingRegistryDelegateLinux::DeleteAll() { | 69 bool PairingRegistryDelegateLinux::DeleteAll() { |
68 // Delete all pairing files in the pairing registry. | 70 // Delete all pairing files in the pairing registry. |
69 base::FilePath registry_path = GetRegistryPath(); | 71 base::FilePath registry_path = GetRegistryPath(); |
70 base::FileEnumerator enumerator(registry_path, false, | 72 base::FileEnumerator enumerator(registry_path, false, |
71 base::FileEnumerator::FILES, | 73 base::FileEnumerator::FILES, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void PairingRegistryDelegateLinux::SetRegistryPathForTesting( | 156 void PairingRegistryDelegateLinux::SetRegistryPathForTesting( |
155 const base::FilePath& registry_path) { | 157 const base::FilePath& registry_path) { |
156 registry_path_for_testing_ = registry_path; | 158 registry_path_for_testing_ = registry_path; |
157 } | 159 } |
158 | 160 |
159 std::unique_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { | 161 std::unique_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { |
160 return base::WrapUnique(new PairingRegistryDelegateLinux()); | 162 return base::WrapUnique(new PairingRegistryDelegateLinux()); |
161 } | 163 } |
162 | 164 |
163 } // namespace remoting | 165 } // namespace remoting |
OLD | NEW |