Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / chrome / common / chrome_paths.cc
blobf58680e09665dc587e9859d615c7bec1429e2bed
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
3 // found in the LICENSE file.
5 #include "chrome/common/chrome_paths.h"
7 #include "base/files/file_util.h"
8 #include "base/lazy_instance.h"
9 #include "base/logging.h"
10 #include "base/mac/bundle_locations.h"
11 #include "base/path_service.h"
12 #include "base/strings/string_util.h"
13 #include "base/sys_info.h"
14 #include "base/threading/thread_restrictions.h"
15 #include "base/version.h"
16 #include "chrome/common/chrome_constants.h"
17 #include "chrome/common/chrome_paths_internal.h"
18 #include "chrome/common/widevine_cdm_constants.h"
19 #include "ui/base/ui_base_paths.h"
21 #if defined(OS_ANDROID)
22 #include "base/android/path_utils.h"
23 #include "base/base_paths_android.h"
24 #endif
26 #if defined(OS_MACOSX)
27 #include "base/mac/foundation_util.h"
28 #endif
30 #if defined(OS_WIN)
31 #include "base/win/registry.h"
32 #endif
34 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
36 namespace {
38 #if defined(OS_WIN)
39 const wchar_t kFlashRegistryRoot[] = L"SOFTWARE\\Macromedia\\FlashPlayerPepper";
41 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath";
42 #endif
44 // File name of the internal Flash plugin on different platforms.
45 const base::FilePath::CharType kInternalFlashPluginFileName[] =
46 #if defined(OS_MACOSX)
47 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin");
48 #elif defined(OS_WIN)
49 FILE_PATH_LITERAL("gcswf32.dll");
50 #else // OS_LINUX, etc.
51 FILE_PATH_LITERAL("libgcflashplayer.so");
52 #endif
54 // The Pepper Flash plugins are in a directory with this name.
55 const base::FilePath::CharType kPepperFlashBaseDirectory[] =
56 FILE_PATH_LITERAL("PepperFlash");
58 #if defined(OS_WIN)
59 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] =
60 FILE_PATH_LITERAL("Macromed\\Flash");
61 #elif defined(OS_MACOSX) && !defined(OS_IOS)
62 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] =
63 FILE_PATH_LITERAL("Internet Plug-Ins/PepperFlashPlayer");
64 #endif
66 const base::FilePath::CharType kInternalNaClPluginFileName[] =
67 FILE_PATH_LITERAL("internal-nacl-plugin");
69 const base::FilePath::CharType kEffectsPluginFileName[] =
70 #if defined(OS_WIN)
71 FILE_PATH_LITERAL("pepper/libppeffects.dll");
72 #elif defined(OS_MACOSX)
73 FILE_PATH_LITERAL("pepper/libppeffects.plugin");
74 #else // Linux and Chrome OS
75 FILE_PATH_LITERAL("pepper/libppeffects.so");
76 #endif
78 #if defined(OS_LINUX)
79 // The path to the external extension <id>.json files.
80 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/
81 const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
82 #if defined(GOOGLE_CHROME_BUILD)
83 FILE_PATH_LITERAL("/usr/share/google-chrome/extensions");
84 #else
85 FILE_PATH_LITERAL("/usr/share/chromium/extensions");
86 #endif // defined(GOOGLE_CHROME_BUILD)
87 #endif // defined(OS_LINUX)
89 static base::LazyInstance<base::FilePath>
90 g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER;
92 // Gets the path for internal plugins.
93 bool GetInternalPluginsDirectory(base::FilePath* result) {
94 #if defined(OS_MACOSX) && !defined(OS_IOS)
95 // If called from Chrome, get internal plugins from a subdirectory of the
96 // framework.
97 if (base::mac::AmIBundled()) {
98 *result = chrome::GetFrameworkBundlePath();
99 DCHECK(!result->empty());
100 *result = result->Append("Internet Plug-Ins");
101 return true;
103 // In tests, just look in the module directory (below).
104 #endif
106 // The rest of the world expects plugins in the module directory.
107 return PathService::Get(base::DIR_MODULE, result);
110 #if defined(OS_WIN)
111 // Gets the Flash path if installed on the system.
112 bool GetSystemFlashDirectory(base::FilePath* out_path) {
113 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kFlashRegistryRoot, KEY_READ);
114 base::string16 path_str;
115 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str)))
116 return false;
117 base::FilePath plugin_path = base::FilePath(path_str).DirName();
119 *out_path = plugin_path;
120 return true;
122 #endif
124 } // namespace
126 namespace chrome {
128 bool PathProvider(int key, base::FilePath* result) {
129 // Some keys are just aliases...
130 switch (key) {
131 case chrome::DIR_APP:
132 return PathService::Get(base::DIR_MODULE, result);
133 case chrome::DIR_LOGS:
134 #ifdef NDEBUG
135 // Release builds write to the data dir
136 return PathService::Get(chrome::DIR_USER_DATA, result);
137 #else
138 // Debug builds write next to the binary (in the build tree)
139 #if defined(OS_MACOSX)
140 if (!PathService::Get(base::DIR_EXE, result))
141 return false;
142 if (base::mac::AmIBundled()) {
143 // If we're called from chrome, dump it beside the app (outside the
144 // app bundle), if we're called from a unittest, we'll already
145 // outside the bundle so use the exe dir.
146 // exe_dir gave us .../Chromium.app/Contents/MacOS/Chromium.
147 *result = result->DirName();
148 *result = result->DirName();
149 *result = result->DirName();
151 return true;
152 #else
153 return PathService::Get(base::DIR_EXE, result);
154 #endif // defined(OS_MACOSX)
155 #endif // NDEBUG
156 case chrome::FILE_RESOURCE_MODULE:
157 return PathService::Get(base::FILE_MODULE, result);
160 // Assume that we will not need to create the directory if it does not exist.
161 // This flag can be set to true for the cases where we want to create it.
162 bool create_dir = false;
164 base::FilePath cur;
165 switch (key) {
166 case chrome::DIR_USER_DATA:
167 if (!GetDefaultUserDataDirectory(&cur)) {
168 NOTREACHED();
169 return false;
171 create_dir = true;
172 break;
173 case chrome::DIR_USER_DOCUMENTS:
174 if (!GetUserDocumentsDirectory(&cur))
175 return false;
176 create_dir = true;
177 break;
178 case chrome::DIR_USER_MUSIC:
179 if (!GetUserMusicDirectory(&cur))
180 return false;
181 break;
182 case chrome::DIR_USER_PICTURES:
183 if (!GetUserPicturesDirectory(&cur))
184 return false;
185 break;
186 case chrome::DIR_USER_VIDEOS:
187 if (!GetUserVideosDirectory(&cur))
188 return false;
189 break;
190 case chrome::DIR_DEFAULT_DOWNLOADS_SAFE:
191 #if defined(OS_WIN) || defined(OS_LINUX)
192 if (!GetUserDownloadsDirectorySafe(&cur))
193 return false;
194 break;
195 #else
196 // Fall through for all other platforms.
197 #endif
198 case chrome::DIR_DEFAULT_DOWNLOADS:
199 #if defined(OS_ANDROID)
200 if (!base::android::GetDownloadsDirectory(&cur))
201 return false;
202 #else
203 if (!GetUserDownloadsDirectory(&cur))
204 return false;
205 // Do not create the download directory here, we have done it twice now
206 // and annoyed a lot of users.
207 #endif
208 break;
209 case chrome::DIR_CRASH_DUMPS:
210 #if defined(OS_CHROMEOS)
211 // ChromeOS uses a separate directory. See http://crosbug.com/25089
212 cur = base::FilePath("/var/log/chrome");
213 #elif defined(OS_ANDROID)
214 if (!base::android::GetCacheDirectory(&cur))
215 return false;
216 #else
217 // The crash reports are always stored relative to the default user data
218 // directory. This avoids the problem of having to re-initialize the
219 // exception handler after parsing command line options, which may
220 // override the location of the app's profile directory.
221 if (!GetDefaultUserDataDirectory(&cur))
222 return false;
223 #endif
224 #if defined(OS_MACOSX)
225 cur = cur.Append(FILE_PATH_LITERAL("Crashpad"));
226 #else
227 cur = cur.Append(FILE_PATH_LITERAL("Crash Reports"));
228 #endif
229 create_dir = true;
230 break;
231 #if defined(OS_WIN)
232 case chrome::DIR_WATCHER_DATA:
233 // The watcher data is always stored relative to the default user data
234 // directory. This allows the watcher to be initialized before
235 // command-line options have been parsed.
236 if (!GetDefaultUserDataDirectory(&cur))
237 return false;
238 cur = cur.Append(FILE_PATH_LITERAL("Diagnostics"));
239 break;
240 #endif
241 case chrome::DIR_RESOURCES:
242 #if defined(OS_MACOSX)
243 cur = base::mac::FrameworkBundlePath();
244 cur = cur.Append(FILE_PATH_LITERAL("Resources"));
245 #else
246 if (!PathService::Get(chrome::DIR_APP, &cur))
247 return false;
248 cur = cur.Append(FILE_PATH_LITERAL("resources"));
249 #endif
250 break;
251 case chrome::DIR_INSPECTOR:
252 if (!PathService::Get(chrome::DIR_RESOURCES, &cur))
253 return false;
254 cur = cur.Append(FILE_PATH_LITERAL("inspector"));
255 break;
256 case chrome::DIR_APP_DICTIONARIES:
257 #if defined(OS_POSIX)
258 // We can't write into the EXE dir on Linux, so keep dictionaries
259 // alongside the safe browsing database in the user data dir.
260 // And we don't want to write into the bundle on the Mac, so push
261 // it to the user data dir there also.
262 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
263 return false;
264 #else
265 if (!PathService::Get(base::DIR_EXE, &cur))
266 return false;
267 #endif
268 cur = cur.Append(FILE_PATH_LITERAL("Dictionaries"));
269 create_dir = true;
270 break;
271 case chrome::DIR_INTERNAL_PLUGINS:
272 if (!GetInternalPluginsDirectory(&cur))
273 return false;
274 break;
275 case chrome::DIR_PEPPER_FLASH_PLUGIN:
276 if (!GetInternalPluginsDirectory(&cur))
277 return false;
278 cur = cur.Append(kPepperFlashBaseDirectory);
279 break;
280 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN:
281 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
282 return false;
283 cur = cur.Append(kPepperFlashBaseDirectory);
284 break;
285 case chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN:
286 #if defined(OS_WIN)
287 if (!GetSystemFlashDirectory(&cur))
288 return false;
289 #elif defined(OS_MACOSX) && !defined(OS_IOS)
290 if (!GetLocalLibraryDirectory(&cur))
291 return false;
292 cur = cur.Append(kPepperFlashSystemBaseDirectory);
293 #else
294 // Chrome on iOS does not supports PPAPI binaries, return false.
295 // TODO(wfh): If Adobe release PPAPI binaries for Linux, add support here.
296 return false;
297 #endif
298 break;
299 case chrome::FILE_LOCAL_STATE:
300 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
301 return false;
302 cur = cur.Append(chrome::kLocalStateFilename);
303 break;
304 case chrome::FILE_RECORDED_SCRIPT:
305 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
306 return false;
307 cur = cur.Append(FILE_PATH_LITERAL("script.log"));
308 break;
309 case chrome::FILE_FLASH_PLUGIN:
310 if (!GetInternalPluginsDirectory(&cur))
311 return false;
312 cur = cur.Append(kInternalFlashPluginFileName);
313 break;
314 case chrome::FILE_PEPPER_FLASH_PLUGIN:
315 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &cur))
316 return false;
317 cur = cur.Append(chrome::kPepperFlashPluginFilename);
318 break;
319 case chrome::FILE_EFFECTS_PLUGIN:
320 if (!GetInternalPluginsDirectory(&cur))
321 return false;
322 cur = cur.Append(kEffectsPluginFileName);
323 break;
324 // TODO(teravest): Remove this case once the internal NaCl plugin is gone.
325 // We currently need a path here to look up whether the plugin is disabled
326 // and what its permissions are.
327 case chrome::FILE_NACL_PLUGIN:
328 if (!GetInternalPluginsDirectory(&cur))
329 return false;
330 cur = cur.Append(kInternalNaClPluginFileName);
331 break;
332 // PNaCl is currenly installable via the component updater or by being
333 // simply built-in. DIR_PNACL_BASE is used as the base directory for
334 // installation via component updater. DIR_PNACL_COMPONENT will be
335 // the final location of pnacl, which is a subdir of DIR_PNACL_BASE.
336 case chrome::DIR_PNACL_BASE:
337 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
338 return false;
339 cur = cur.Append(FILE_PATH_LITERAL("pnacl"));
340 break;
341 // Where PNaCl files are ultimately located. The default finds the files
342 // inside the InternalPluginsDirectory / build directory, as if it
343 // was shipped along with chrome. The value can be overridden
344 // if it is installed via component updater.
345 case chrome::DIR_PNACL_COMPONENT:
346 #if defined(OS_MACOSX)
347 // PNaCl really belongs in the InternalPluginsDirectory but actually
348 // copying it there would result in the files also being shipped, which
349 // we don't want yet. So for now, just find them in the directory where
350 // they get built.
351 if (!PathService::Get(base::DIR_EXE, &cur))
352 return false;
353 if (base::mac::AmIBundled()) {
354 // If we're called from chrome, it's beside the app (outside the
355 // app bundle), if we're called from a unittest, we'll already be
356 // outside the bundle so use the exe dir.
357 // exe_dir gave us .../Chromium.app/Contents/MacOS/Chromium.
358 cur = cur.DirName();
359 cur = cur.DirName();
360 cur = cur.DirName();
362 #else
363 if (!GetInternalPluginsDirectory(&cur))
364 return false;
365 #endif
366 cur = cur.Append(FILE_PATH_LITERAL("pnacl"));
367 break;
368 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
369 #if defined(WIDEVINE_CDM_IS_COMPONENT)
370 case chrome::DIR_COMPONENT_WIDEVINE_CDM:
371 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
372 return false;
373 cur = cur.Append(kWidevineCdmBaseDirectory);
374 break;
375 #endif // defined(WIDEVINE_CDM_IS_COMPONENT)
376 // TODO(xhwang): FILE_WIDEVINE_CDM_ADAPTER has different meanings.
377 // In the component case, this is the source adapter. Otherwise, it is the
378 // actual Pepper module that gets loaded.
379 case chrome::FILE_WIDEVINE_CDM_ADAPTER:
380 if (!GetInternalPluginsDirectory(&cur))
381 return false;
382 cur = cur.AppendASCII(kWidevineCdmAdapterFileName);
383 break;
384 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
385 case chrome::FILE_RESOURCES_PACK:
386 #if defined(OS_MACOSX) && !defined(OS_IOS)
387 if (base::mac::AmIBundled()) {
388 cur = base::mac::FrameworkBundlePath();
389 cur = cur.Append(FILE_PATH_LITERAL("Resources"))
390 .Append(FILE_PATH_LITERAL("resources.pak"));
391 break;
393 #elif defined(OS_ANDROID)
394 if (!PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &cur))
395 return false;
396 #else
397 // If we're not bundled on mac or Android, resources.pak should be next
398 // to the binary (e.g., for unit tests).
399 if (!PathService::Get(base::DIR_MODULE, &cur))
400 return false;
401 #endif
402 cur = cur.Append(FILE_PATH_LITERAL("resources.pak"));
403 break;
404 case chrome::DIR_RESOURCES_EXTENSION:
405 if (!PathService::Get(base::DIR_MODULE, &cur))
406 return false;
407 cur = cur.Append(FILE_PATH_LITERAL("resources"))
408 .Append(FILE_PATH_LITERAL("extension"));
409 break;
410 #if defined(OS_CHROMEOS)
411 case chrome::DIR_CHROMEOS_WALLPAPERS:
412 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
413 return false;
414 cur = cur.Append(FILE_PATH_LITERAL("wallpapers"));
415 break;
416 case chrome::DIR_CHROMEOS_WALLPAPER_THUMBNAILS:
417 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
418 return false;
419 cur = cur.Append(FILE_PATH_LITERAL("wallpaper_thumbnails"));
420 break;
421 case chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS:
422 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
423 return false;
424 cur = cur.Append(FILE_PATH_LITERAL("custom_wallpapers"));
425 break;
426 #endif
427 #if defined(OS_LINUX) && defined(ENABLE_SUPERVISED_USERS)
428 case chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS:
429 if (!PathService::Get(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, &cur))
430 return false;
431 cur = cur.Append(FILE_PATH_LITERAL("managed_users"));
432 break;
433 #endif
434 // The following are only valid in the development environment, and
435 // will fail if executed from an installed executable (because the
436 // generated path won't exist).
437 case chrome::DIR_GEN_TEST_DATA:
438 #if defined(OS_ANDROID)
439 // On Android, our tests don't have permission to write to DIR_MODULE.
440 // gtest/test_runner.py pushes data to external storage.
441 if (!PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &cur))
442 return false;
443 #else
444 if (!PathService::Get(base::DIR_MODULE, &cur))
445 return false;
446 #endif
447 cur = cur.Append(FILE_PATH_LITERAL("test_data"));
448 if (!base::PathExists(cur)) // We don't want to create this.
449 return false;
450 break;
451 case chrome::DIR_TEST_DATA:
452 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur))
453 return false;
454 cur = cur.Append(FILE_PATH_LITERAL("chrome"));
455 cur = cur.Append(FILE_PATH_LITERAL("test"));
456 cur = cur.Append(FILE_PATH_LITERAL("data"));
457 if (!base::PathExists(cur)) // We don't want to create this.
458 return false;
459 break;
460 case chrome::DIR_TEST_TOOLS:
461 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur))
462 return false;
463 cur = cur.Append(FILE_PATH_LITERAL("chrome"));
464 cur = cur.Append(FILE_PATH_LITERAL("tools"));
465 cur = cur.Append(FILE_PATH_LITERAL("test"));
466 if (!base::PathExists(cur)) // We don't want to create this
467 return false;
468 break;
469 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
470 case chrome::DIR_POLICY_FILES: {
471 #if defined(GOOGLE_CHROME_BUILD)
472 cur = base::FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies"));
473 #else
474 cur = base::FilePath(FILE_PATH_LITERAL("/etc/chromium/policies"));
475 #endif
476 break;
478 #endif
479 #if defined(OS_MACOSX) && !defined(OS_IOS)
480 case chrome::DIR_USER_LIBRARY: {
481 if (!GetUserLibraryDirectory(&cur))
482 return false;
483 if (!base::PathExists(cur)) // We don't want to create this.
484 return false;
485 break;
487 case chrome::DIR_USER_APPLICATIONS: {
488 if (!GetUserApplicationsDirectory(&cur))
489 return false;
490 if (!base::PathExists(cur)) // We don't want to create this.
491 return false;
492 break;
494 #endif
495 #if defined(OS_CHROMEOS) || (defined(OS_MACOSX) && !defined(OS_IOS))
496 case chrome::DIR_USER_EXTERNAL_EXTENSIONS: {
497 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
498 return false;
499 cur = cur.Append(FILE_PATH_LITERAL("External Extensions"));
500 break;
502 #endif
503 #if defined(OS_LINUX)
504 case chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS: {
505 cur = base::FilePath(kFilepathSinglePrefExtensions);
506 break;
508 #endif
509 case chrome::DIR_EXTERNAL_EXTENSIONS:
510 #if defined(OS_MACOSX) && !defined(OS_IOS)
511 if (!chrome::GetGlobalApplicationSupportDirectory(&cur))
512 return false;
514 cur = cur.Append(FILE_PATH_LITERAL("Google"))
515 .Append(FILE_PATH_LITERAL("Chrome"))
516 .Append(FILE_PATH_LITERAL("External Extensions"));
517 create_dir = false;
518 #else
519 if (!PathService::Get(base::DIR_MODULE, &cur))
520 return false;
522 cur = cur.Append(FILE_PATH_LITERAL("extensions"));
523 create_dir = true;
524 #endif
525 break;
527 case chrome::DIR_DEFAULT_APPS:
528 #if defined(OS_MACOSX)
529 cur = base::mac::FrameworkBundlePath();
530 cur = cur.Append(FILE_PATH_LITERAL("Default Apps"));
531 #else
532 if (!PathService::Get(chrome::DIR_APP, &cur))
533 return false;
534 cur = cur.Append(FILE_PATH_LITERAL("default_apps"));
535 #endif
536 break;
538 #if defined(OS_LINUX) || (defined(OS_MACOSX) && !defined(OS_IOS))
539 case chrome::DIR_NATIVE_MESSAGING:
540 #if defined(OS_MACOSX)
541 #if defined(GOOGLE_CHROME_BUILD)
542 cur = base::FilePath(FILE_PATH_LITERAL(
543 "/Library/Google/Chrome/NativeMessagingHosts"));
544 #else
545 cur = base::FilePath(FILE_PATH_LITERAL(
546 "/Library/Application Support/Chromium/NativeMessagingHosts"));
547 #endif
548 #else // defined(OS_MACOSX)
549 #if defined(GOOGLE_CHROME_BUILD)
550 cur = base::FilePath(FILE_PATH_LITERAL(
551 "/etc/opt/chrome/native-messaging-hosts"));
552 #else
553 cur = base::FilePath(FILE_PATH_LITERAL(
554 "/etc/chromium/native-messaging-hosts"));
555 #endif
556 #endif // !defined(OS_MACOSX)
557 break;
559 case chrome::DIR_USER_NATIVE_MESSAGING:
560 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
561 return false;
562 cur = cur.Append(FILE_PATH_LITERAL("NativeMessagingHosts"));
563 break;
564 #endif // defined(OS_LINUX) || (defined(OS_MACOSX) && !defined(OS_IOS))
565 #if !defined(OS_ANDROID)
566 case chrome::DIR_GLOBAL_GCM_STORE:
567 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
568 return false;
569 cur = cur.Append(kGCMStoreDirname);
570 break;
571 #endif // !defined(OS_ANDROID)
573 default:
574 return false;
577 // TODO(bauerb): http://crbug.com/259796
578 base::ThreadRestrictions::ScopedAllowIO allow_io;
579 if (create_dir && !base::PathExists(cur) &&
580 !base::CreateDirectory(cur))
581 return false;
583 *result = cur;
584 return true;
587 // This cannot be done as a static initializer sadly since Visual Studio will
588 // eliminate this object file if there is no direct entry point into it.
589 void RegisterPathProvider() {
590 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
593 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) {
594 g_invalid_specified_user_data_dir.Get() = user_data_dir;
597 const base::FilePath& GetInvalidSpecifiedUserDataDir() {
598 return g_invalid_specified_user_data_dir.Get();
601 } // namespace chrome