OLD | NEW |
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // |success| is set to true on success and false on failure. | 115 // |success| is set to true on success and false on failure. |
116 void SaveBitmap(ImageData* data, | 116 void SaveBitmap(ImageData* data, |
117 const base::FilePath& image_path, | 117 const base::FilePath& image_path, |
118 bool* success) { | 118 bool* success) { |
119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
120 scoped_ptr<ImageData> data_owner(data); | 120 scoped_ptr<ImageData> data_owner(data); |
121 *success = false; | 121 *success = false; |
122 | 122 |
123 // Make sure the destination directory exists. | 123 // Make sure the destination directory exists. |
124 base::FilePath dir = image_path.DirName(); | 124 base::FilePath dir = image_path.DirName(); |
125 if (!file_util::DirectoryExists(dir) && !file_util::CreateDirectory(dir)) { | 125 if (!base::DirectoryExists(dir) && !file_util::CreateDirectory(dir)) { |
126 LOG(ERROR) << "Failed to create parent directory."; | 126 LOG(ERROR) << "Failed to create parent directory."; |
127 return; | 127 return; |
128 } | 128 } |
129 | 129 |
130 if (file_util::WriteFile(image_path, | 130 if (file_util::WriteFile(image_path, |
131 reinterpret_cast<char*>(&(*data)[0]), | 131 reinterpret_cast<char*>(&(*data)[0]), |
132 data->size()) == -1) { | 132 data->size()) == -1) { |
133 LOG(ERROR) << "Failed to save image to file."; | 133 LOG(ERROR) << "Failed to save image to file."; |
134 return; | 134 return; |
135 } | 135 } |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 info->GetString(kNameKey, &name); | 836 info->GetString(kNameKey, &name); |
837 names.push_back(name); | 837 names.push_back(name); |
838 } | 838 } |
839 return names; | 839 return names; |
840 } | 840 } |
841 | 841 |
842 // static | 842 // static |
843 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { | 843 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { |
844 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); | 844 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); |
845 } | 845 } |
OLD | NEW |