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

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

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 // Value written to prefs for EXIT_CRASHED and EXIT_SESSION_ENDED. 169 // Value written to prefs for EXIT_CRASHED and EXIT_SESSION_ENDED.
170 const char* const kPrefExitTypeCrashed = "Crashed"; 170 const char* const kPrefExitTypeCrashed = "Crashed";
171 const char* const kPrefExitTypeSessionEnded = "SessionEnded"; 171 const char* const kPrefExitTypeSessionEnded = "SessionEnded";
172 172
173 // Helper method needed because PostTask cannot currently take a Callback 173 // Helper method needed because PostTask cannot currently take a Callback
174 // function with non-void return type. 174 // function with non-void return type.
175 void CreateDirectoryAndSignal(const base::FilePath& path, 175 void CreateDirectoryAndSignal(const base::FilePath& path,
176 base::WaitableEvent* done_creating) { 176 base::WaitableEvent* done_creating) {
177 DVLOG(1) << "Creating directory " << path.value(); 177 DVLOG(1) << "Creating directory " << path.value();
178 file_util::CreateDirectory(path); 178 base::CreateDirectory(path);
179 done_creating->Signal(); 179 done_creating->Signal();
180 } 180 }
181 181
182 // Task that blocks the FILE thread until CreateDirectoryAndSignal() finishes on 182 // Task that blocks the FILE thread until CreateDirectoryAndSignal() finishes on
183 // blocking I/O pool. 183 // blocking I/O pool.
184 void BlockFileThreadOnDirectoryCreate(base::WaitableEvent* done_creating) { 184 void BlockFileThreadOnDirectoryCreate(base::WaitableEvent* done_creating) {
185 done_creating->Wait(); 185 done_creating->Wait();
186 } 186 }
187 187
188 // Initiates creation of profile directory on |sequenced_task_runner| and 188 // Initiates creation of profile directory on |sequenced_task_runner| and
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 JsonPrefStore::GetTaskRunnerForFile(path, 271 JsonPrefStore::GetTaskRunnerForFile(path,
272 BrowserThread::GetBlockingPool()); 272 BrowserThread::GetBlockingPool());
273 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { 273 if (create_mode == CREATE_MODE_ASYNCHRONOUS) {
274 DCHECK(delegate); 274 DCHECK(delegate);
275 CreateProfileDirectory(sequenced_task_runner.get(), path); 275 CreateProfileDirectory(sequenced_task_runner.get(), path);
276 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { 276 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) {
277 if (!base::PathExists(path)) { 277 if (!base::PathExists(path)) {
278 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the 278 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the
279 // profile directory. We should eventually be able to run in this 279 // profile directory. We should eventually be able to run in this
280 // situation. 280 // situation.
281 if (!file_util::CreateDirectory(path)) 281 if (!base::CreateDirectory(path))
282 return NULL; 282 return NULL;
283 } 283 }
284 } else { 284 } else {
285 NOTREACHED(); 285 NOTREACHED();
286 } 286 }
287 287
288 return new ProfileImpl( 288 return new ProfileImpl(
289 path, delegate, create_mode, sequenced_task_runner.get()); 289 path, delegate, create_mode, sequenced_task_runner.get());
290 } 290 }
291 291
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { 1247 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() {
1248 #if defined(OS_CHROMEOS) 1248 #if defined(OS_CHROMEOS)
1249 if (chromeos::ProfileHelper::IsSigninProfile(this)) { 1249 if (chromeos::ProfileHelper::IsSigninProfile(this)) {
1250 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( 1250 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
1251 g_browser_process->local_state()); 1251 g_browser_process->local_state());
1252 } 1252 }
1253 #endif // defined(OS_CHROMEOS) 1253 #endif // defined(OS_CHROMEOS)
1254 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( 1254 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile(
1255 GetPrefs(), g_browser_process->local_state()); 1255 GetPrefs(), g_browser_process->local_state());
1256 } 1256 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/printing_layout_browsertest.cc ('k') | chrome/browser/profiles/profile_info_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698