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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 base::FilePath GetCachePath(const base::FilePath& base) { 195 base::FilePath GetCachePath(const base::FilePath& base) {
196 return base.Append(chrome::kCacheDirname); 196 return base.Append(chrome::kCacheDirname);
197 } 197 }
198 198
199 base::FilePath GetMediaCachePath(const base::FilePath& base) { 199 base::FilePath GetMediaCachePath(const base::FilePath& base) {
200 return base.Append(chrome::kMediaCacheDirname); 200 return base.Append(chrome::kMediaCacheDirname);
201 } 201 }
202 202
203 void EnsureReadmeFile(const base::FilePath& base) { 203 void EnsureReadmeFile(const base::FilePath& base) {
204 base::FilePath readme_path = base.Append(chrome::kReadmeFilename); 204 base::FilePath readme_path = base.Append(chrome::kReadmeFilename);
205 if (file_util::PathExists(readme_path)) 205 if (base::PathExists(readme_path))
206 return; 206 return;
207 std::string product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); 207 std::string product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
208 std::string readme_text = base::StringPrintf( 208 std::string readme_text = base::StringPrintf(
209 kReadmeText, product_name.c_str(), product_name.c_str()); 209 kReadmeText, product_name.c_str(), product_name.c_str());
210 if (file_util::WriteFile( 210 if (file_util::WriteFile(
211 readme_path, readme_text.data(), readme_text.size()) == -1) { 211 readme_path, readme_text.data(), readme_text.size()) == -1) {
212 LOG(ERROR) << "Could not create README file."; 212 LOG(ERROR) << "Could not create README file.";
213 } 213 }
214 } 214 }
215 215
(...skipping 30 matching lines...) Expand all
246 // Get sequenced task runner for making sure that file operations of 246 // Get sequenced task runner for making sure that file operations of
247 // this profile (defined by |path|) are executed in expected order 247 // this profile (defined by |path|) are executed in expected order
248 // (what was previously assured by the FILE thread). 248 // (what was previously assured by the FILE thread).
249 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = 249 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner =
250 JsonPrefStore::GetTaskRunnerForFile(path, 250 JsonPrefStore::GetTaskRunnerForFile(path,
251 BrowserThread::GetBlockingPool()); 251 BrowserThread::GetBlockingPool());
252 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { 252 if (create_mode == CREATE_MODE_ASYNCHRONOUS) {
253 DCHECK(delegate); 253 DCHECK(delegate);
254 CreateProfileDirectory(sequenced_task_runner.get(), path); 254 CreateProfileDirectory(sequenced_task_runner.get(), path);
255 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { 255 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) {
256 if (!file_util::PathExists(path)) { 256 if (!base::PathExists(path)) {
257 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the 257 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the
258 // profile directory. We should eventually be able to run in this 258 // profile directory. We should eventually be able to run in this
259 // situation. 259 // situation.
260 if (!file_util::CreateDirectory(path)) 260 if (!file_util::CreateDirectory(path))
261 return NULL; 261 return NULL;
262 } 262 }
263 } else { 263 } else {
264 NOTREACHED(); 264 NOTREACHED();
265 } 265 }
266 266
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 base::FilePath* cache_path, 1146 base::FilePath* cache_path,
1147 int* max_size) { 1147 int* max_size) {
1148 DCHECK(cache_path); 1148 DCHECK(cache_path);
1149 DCHECK(max_size); 1149 DCHECK(max_size);
1150 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); 1150 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir));
1151 if (!path.empty()) 1151 if (!path.empty())
1152 *cache_path = path; 1152 *cache_path = path;
1153 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1153 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1154 prefs_->GetInteger(prefs::kDiskCacheSize); 1154 prefs_->GetInteger(prefs::kDiskCacheSize);
1155 } 1155 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_browsertest.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698