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_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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |