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

Side by Side Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/profiles/profile_info_cache.h" 5 #include "chrome/browser/profiles/profile_info_cache.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/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 scoped_ptr<ImageData> data_owner(data); 127 scoped_ptr<ImageData> data_owner(data);
128 *success = false; 128 *success = false;
129 129
130 // Make sure the destination directory exists. 130 // Make sure the destination directory exists.
131 base::FilePath dir = image_path.DirName(); 131 base::FilePath dir = image_path.DirName();
132 if (!base::DirectoryExists(dir) && !base::CreateDirectory(dir)) { 132 if (!base::DirectoryExists(dir) && !base::CreateDirectory(dir)) {
133 LOG(ERROR) << "Failed to create parent directory."; 133 LOG(ERROR) << "Failed to create parent directory.";
134 return; 134 return;
135 } 135 }
136 136
137 if (file_util::WriteFile(image_path, 137 if (base::WriteFile(image_path, reinterpret_cast<char*>(&(*data)[0]),
138 reinterpret_cast<char*>(&(*data)[0]), 138 data->size()) == -1) {
139 data->size()) == -1) {
140 LOG(ERROR) << "Failed to save image to file."; 139 LOG(ERROR) << "Failed to save image to file.";
141 return; 140 return;
142 } 141 }
143 142
144 *success = true; 143 *success = true;
145 } 144 }
146 145
147 // Reads a PNG from disk and decodes it. If the bitmap was successfully read 146 // Reads a PNG from disk and decodes it. If the bitmap was successfully read
148 // from disk the then |out_image| will contain the bitmap image, otherwise it 147 // from disk the then |out_image| will contain the bitmap image, otherwise it
149 // will be NULL. 148 // will be NULL.
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 info->GetString(kNameKey, &name); 988 info->GetString(kNameKey, &name);
990 names.push_back(name); 989 names.push_back(name);
991 } 990 }
992 return names; 991 return names;
993 } 992 }
994 993
995 // static 994 // static
996 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { 995 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) {
997 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); 996 registry->RegisterDictionaryPref(prefs::kProfileInfoCache);
998 } 997 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/safe_browsing/download_feedback_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698