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

Side by Side Diff: chrome/browser/chromeos/customization_document.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/customization_document.h" 5 #include "chrome/browser/chromeos/customization_document.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 CustomizationDocument::CustomizationDocument( 74 CustomizationDocument::CustomizationDocument(
75 const std::string& accepted_version) 75 const std::string& accepted_version)
76 : accepted_version_(accepted_version) {} 76 : accepted_version_(accepted_version) {}
77 77
78 CustomizationDocument::~CustomizationDocument() {} 78 CustomizationDocument::~CustomizationDocument() {}
79 79
80 bool CustomizationDocument::LoadManifestFromFile( 80 bool CustomizationDocument::LoadManifestFromFile(
81 const base::FilePath& manifest_path) { 81 const base::FilePath& manifest_path) {
82 std::string manifest; 82 std::string manifest;
83 if (!file_util::ReadFileToString(manifest_path, &manifest)) 83 if (!base::ReadFileToString(manifest_path, &manifest))
84 return false; 84 return false;
85 return LoadManifestFromString(manifest); 85 return LoadManifestFromString(manifest);
86 } 86 }
87 87
88 bool CustomizationDocument::LoadManifestFromString( 88 bool CustomizationDocument::LoadManifestFromString(
89 const std::string& manifest) { 89 const std::string& manifest) {
90 int error_code = 0; 90 int error_code = 0;
91 std::string error; 91 std::string error;
92 scoped_ptr<Value> root(base::JSONReader::ReadAndReturnError(manifest, 92 scoped_ptr<Value> root(base::JSONReader::ReadAndReturnError(manifest,
93 base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error)); 93 base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error));
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } else { 273 } else {
274 StartFileFetch(); 274 StartFileFetch();
275 } 275 }
276 } 276 }
277 277
278 void ServicesCustomizationDocument::ReadFileInBackground( 278 void ServicesCustomizationDocument::ReadFileInBackground(
279 const base::FilePath& file) { 279 const base::FilePath& file) {
280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
281 281
282 std::string manifest; 282 std::string manifest;
283 if (file_util::ReadFileToString(file, &manifest)) { 283 if (base::ReadFileToString(file, &manifest)) {
284 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 284 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
285 base::Bind( 285 base::Bind(
286 base::IgnoreResult( 286 base::IgnoreResult(
287 &ServicesCustomizationDocument::LoadManifestFromString), 287 &ServicesCustomizationDocument::LoadManifestFromString),
288 base::Unretained(this), // this class is a singleton. 288 base::Unretained(this), // this class is a singleton.
289 manifest)); 289 manifest));
290 } else { 290 } else {
291 VLOG(1) << "Failed to load services customization manifest from: " 291 VLOG(1) << "Failed to load services customization manifest from: "
292 << file.value(); 292 << file.value();
293 } 293 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 locale, kAppContentAttr, kInitialStartPageAttr); 337 locale, kAppContentAttr, kInitialStartPageAttr);
338 } 338 }
339 339
340 std::string ServicesCustomizationDocument::GetSupportPage( 340 std::string ServicesCustomizationDocument::GetSupportPage(
341 const std::string& locale) const { 341 const std::string& locale) const {
342 return GetLocaleSpecificString( 342 return GetLocaleSpecificString(
343 locale, kAppContentAttr, kSupportPageAttr); 343 locale, kAppContentAttr, kSupportPageAttr);
344 } 344 }
345 345
346 } // namespace chromeos 346 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/boot_times_loader.cc ('k') | chrome/browser/chromeos/drive/fake_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698