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

Side by Side Diff: chrome/browser/renderer_host/pepper/device_id_fetcher.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/renderer_host/pepper/device_id_fetcher.h" 5 #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // TODO(raymes): This is temporary code to migrate ChromeOS devices to the new 161 // TODO(raymes): This is temporary code to migrate ChromeOS devices to the new
162 // scheme for generating device IDs. Delete this once we are sure most ChromeOS 162 // scheme for generating device IDs. Delete this once we are sure most ChromeOS
163 // devices have been migrated. 163 // devices have been migrated.
164 void DeviceIDFetcher::ComputeOnBlockingPool(const base::FilePath& profile_path, 164 void DeviceIDFetcher::ComputeOnBlockingPool(const base::FilePath& profile_path,
165 const std::string& salt) { 165 const std::string& salt) {
166 std::string id; 166 std::string id;
167 // First check if the legacy device ID file exists on ChromeOS. If it does, we 167 // First check if the legacy device ID file exists on ChromeOS. If it does, we
168 // should just return that. 168 // should just return that.
169 base::FilePath id_path = GetLegacyDeviceIDPath(profile_path); 169 base::FilePath id_path = GetLegacyDeviceIDPath(profile_path);
170 if (base::PathExists(id_path)) { 170 if (base::PathExists(id_path)) {
171 if (file_util::ReadFileToString(id_path, &id) && !id.empty()) { 171 if (base::ReadFileToString(id_path, &id) && !id.empty()) {
172 RunCallbackOnIOThread(id); 172 RunCallbackOnIOThread(id);
173 return; 173 return;
174 } 174 }
175 } 175 }
176 // If we didn't find an ID, go back to the new code path to generate an ID. 176 // If we didn't find an ID, go back to the new code path to generate an ID.
177 BrowserThread::PostTask( 177 BrowserThread::PostTask(
178 BrowserThread::IO, FROM_HERE, 178 BrowserThread::IO, FROM_HERE,
179 base::Bind(&DeviceIDFetcher::ComputeOnIOThread, this, salt)); 179 base::Bind(&DeviceIDFetcher::ComputeOnIOThread, this, salt));
180 } 180 }
181 181
(...skipping 18 matching lines...) Expand all
200 chromeos::CryptohomeLibrary* c_home = chromeos::CryptohomeLibrary::Get(); 200 chromeos::CryptohomeLibrary* c_home = chromeos::CryptohomeLibrary::Get();
201 return c_home->GetSystemSalt(); 201 return c_home->GetSystemSalt();
202 #else 202 #else
203 // Not implemented for other platforms. 203 // Not implemented for other platforms.
204 NOTREACHED(); 204 NOTREACHED();
205 return ""; 205 return "";
206 #endif 206 #endif
207 } 207 }
208 208
209 } // namespace chrome 209 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698