| 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/common/chrome_paths.h" | 5 #include "chrome/common/chrome_paths.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 break; | 394 break; |
| 395 case chrome::DIR_CHROMEOS_WALLPAPER_THUMBNAILS: | 395 case chrome::DIR_CHROMEOS_WALLPAPER_THUMBNAILS: |
| 396 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 396 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) |
| 397 return false; | 397 return false; |
| 398 cur = cur.Append(FILE_PATH_LITERAL("wallpaper_thumbnails")); | 398 cur = cur.Append(FILE_PATH_LITERAL("wallpaper_thumbnails")); |
| 399 break; | 399 break; |
| 400 case chrome::FILE_DEFAULT_APP_ORDER: | 400 case chrome::FILE_DEFAULT_APP_ORDER: |
| 401 cur = FilePath(FILE_PATH_LITERAL(kDefaultAppOrderFileName)); | 401 cur = FilePath(FILE_PATH_LITERAL(kDefaultAppOrderFileName)); |
| 402 break; | 402 break; |
| 403 #endif | 403 #endif |
| 404 #if defined(ENABLE_MANAGED_USERS) |
| 405 case chrome::DIR_MANAGED_USERS_DEFAULT_APPS: |
| 406 if (!PathService::Get(chrome::DIR_EXTERNAL_EXTENSIONS, &cur)) |
| 407 return false; |
| 408 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); |
| 409 break; |
| 410 #endif |
| 404 // The following are only valid in the development environment, and | 411 // The following are only valid in the development environment, and |
| 405 // will fail if executed from an installed executable (because the | 412 // will fail if executed from an installed executable (because the |
| 406 // generated path won't exist). | 413 // generated path won't exist). |
| 407 case chrome::DIR_GEN_TEST_DATA: | 414 case chrome::DIR_GEN_TEST_DATA: |
| 408 if (!PathService::Get(base::DIR_MODULE, &cur)) | 415 if (!PathService::Get(base::DIR_MODULE, &cur)) |
| 409 return false; | 416 return false; |
| 410 cur = cur.Append(FILE_PATH_LITERAL("test_data")); | 417 cur = cur.Append(FILE_PATH_LITERAL("test_data")); |
| 411 if (!file_util::PathExists(cur)) // We don't want to create this. | 418 if (!file_util::PathExists(cur)) // We don't want to create this. |
| 412 return false; | 419 return false; |
| 413 break; | 420 break; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 #endif | 492 #endif |
| 486 break; | 493 break; |
| 487 | 494 |
| 488 case chrome::DIR_DEFAULT_APPS: | 495 case chrome::DIR_DEFAULT_APPS: |
| 489 #if defined(OS_MACOSX) | 496 #if defined(OS_MACOSX) |
| 490 cur = base::mac::FrameworkBundlePath(); | 497 cur = base::mac::FrameworkBundlePath(); |
| 491 cur = cur.Append(FILE_PATH_LITERAL("Default Apps")); | 498 cur = cur.Append(FILE_PATH_LITERAL("Default Apps")); |
| 492 #else | 499 #else |
| 493 if (!PathService::Get(chrome::DIR_APP, &cur)) | 500 if (!PathService::Get(chrome::DIR_APP, &cur)) |
| 494 return false; | 501 return false; |
| 495 cur = cur.Append(FILE_PATH_LITERAL("default_apps")); | 502 cur.Append(FILE_PATH_LITERAL("default_apps")); |
| 496 #endif | 503 #endif |
| 497 break; | 504 break; |
| 498 | 505 |
| 499 default: | 506 default: |
| 500 return false; | 507 return false; |
| 501 } | 508 } |
| 502 | 509 |
| 503 if (create_dir && !file_util::PathExists(cur) && | 510 if (create_dir && !file_util::PathExists(cur) && |
| 504 !file_util::CreateDirectory(cur)) | 511 !file_util::CreateDirectory(cur)) |
| 505 return false; | 512 return false; |
| 506 | 513 |
| 507 *result = cur; | 514 *result = cur; |
| 508 return true; | 515 return true; |
| 509 } | 516 } |
| 510 | 517 |
| 511 // This cannot be done as a static initializer sadly since Visual Studio will | 518 // This cannot be done as a static initializer sadly since Visual Studio will |
| 512 // eliminate this object file if there is no direct entry point into it. | 519 // eliminate this object file if there is no direct entry point into it. |
| 513 void RegisterPathProvider() { | 520 void RegisterPathProvider() { |
| 514 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 521 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 515 } | 522 } |
| 516 | 523 |
| 517 } // namespace chrome | 524 } // namespace chrome |
| OLD | NEW |