Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: remoting/host/pairing_registry_delegate_linux.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::PlatformFileError error;
112 if (!file_util::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();
122 return false; 122 return false;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « net/url_request/url_fetcher_impl_unittest.cc ('k') | remoting/host/setup/daemon_controller_delegate_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698