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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/files/important_file_writer.h" | 10 #include "base/files/important_file_writer.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 LOG(WARNING) << "Failed to parse pairing information: not a dictionary."; | 101 LOG(WARNING) << "Failed to parse pairing information: not a dictionary."; |
102 return PairingRegistry::Pairing(); | 102 return PairingRegistry::Pairing(); |
103 } | 103 } |
104 | 104 |
105 return PairingRegistry::Pairing::CreateFromValue(*pairing_dictionary); | 105 return PairingRegistry::Pairing::CreateFromValue(*pairing_dictionary); |
106 } | 106 } |
107 | 107 |
108 bool PairingRegistryDelegateLinux::Save( | 108 bool PairingRegistryDelegateLinux::Save( |
109 const PairingRegistry::Pairing& pairing) { | 109 const PairingRegistry::Pairing& pairing) { |
110 base::FilePath registry_path = GetRegistryPath(); | 110 base::FilePath registry_path = GetRegistryPath(); |
111 base::PlatformFileError error; | 111 base::File::Error error; |
112 if (!base::CreateDirectoryAndGetError(registry_path, &error)) { | 112 if (!base::CreateDirectoryAndGetError(registry_path, &error)) { |
113 LOG(ERROR) << "Could not create pairing registry directory: " << error; | 113 LOG(ERROR) << "Could not create pairing registry directory: " << error; |
114 return false; | 114 return false; |
115 } | 115 } |
116 | 116 |
117 std::string pairing_json; | 117 std::string pairing_json; |
118 JSONStringValueSerializer serializer(&pairing_json); | 118 JSONStringValueSerializer serializer(&pairing_json); |
119 if (!serializer.Serialize(*pairing.ToValue())) { | 119 if (!serializer.Serialize(*pairing.ToValue())) { |
120 LOG(ERROR) << "Failed to serialize pairing data for " | 120 LOG(ERROR) << "Failed to serialize pairing data for " |
121 << pairing.client_id(); | 121 << pairing.client_id(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 registry_path_for_testing_ = registry_path; | 155 registry_path_for_testing_ = registry_path; |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { | 159 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { |
160 return scoped_ptr<PairingRegistry::Delegate>( | 160 return scoped_ptr<PairingRegistry::Delegate>( |
161 new PairingRegistryDelegateLinux()); | 161 new PairingRegistryDelegateLinux()); |
162 } | 162 } |
163 | 163 |
164 } // namespace remoting | 164 } // namespace remoting |
OLD | NEW |