Chromium Code Reviews| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 break; | 399 break; |
| 400 case chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS: | 400 case chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS: |
| 401 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 401 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) |
| 402 return false; | 402 return false; |
| 403 cur = cur.Append(FILE_PATH_LITERAL("custom_wallpapers")); | 403 cur = cur.Append(FILE_PATH_LITERAL("custom_wallpapers")); |
| 404 break; | 404 break; |
| 405 case chrome::FILE_DEFAULT_APP_ORDER: | 405 case chrome::FILE_DEFAULT_APP_ORDER: |
| 406 cur = base::FilePath(FILE_PATH_LITERAL(kDefaultAppOrderFileName)); | 406 cur = base::FilePath(FILE_PATH_LITERAL(kDefaultAppOrderFileName)); |
| 407 break; | 407 break; |
| 408 #endif | 408 #endif |
| 409 #if defined(ENABLE_MANAGED_USERS) | |
| 410 case chrome::DIR_MANAGED_USERS_DEFAULT_APPS: | |
| 411 if (!PathService::Get(chrome::DIR_EXTERNAL_EXTENSIONS, &cur)) | |
| 412 return false; | |
| 413 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); | |
| 414 break; | |
| 415 #endif | |
| 409 // The following are only valid in the development environment, and | 416 // The following are only valid in the development environment, and |
| 410 // will fail if executed from an installed executable (because the | 417 // will fail if executed from an installed executable (because the |
| 411 // generated path won't exist). | 418 // generated path won't exist). |
| 412 case chrome::DIR_GEN_TEST_DATA: | 419 case chrome::DIR_GEN_TEST_DATA: |
| 413 if (!PathService::Get(base::DIR_MODULE, &cur)) | 420 if (!PathService::Get(base::DIR_MODULE, &cur)) |
| 414 return false; | 421 return false; |
| 415 cur = cur.Append(FILE_PATH_LITERAL("test_data")); | 422 cur = cur.Append(FILE_PATH_LITERAL("test_data")); |
| 416 if (!file_util::PathExists(cur)) // We don't want to create this. | 423 if (!file_util::PathExists(cur)) // We don't want to create this. |
| 417 return false; | 424 return false; |
| 418 break; | 425 break; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 490 #endif | 497 #endif |
| 491 break; | 498 break; |
| 492 | 499 |
| 493 case chrome::DIR_DEFAULT_APPS: | 500 case chrome::DIR_DEFAULT_APPS: |
| 494 #if defined(OS_MACOSX) | 501 #if defined(OS_MACOSX) |
| 495 cur = base::mac::FrameworkBundlePath(); | 502 cur = base::mac::FrameworkBundlePath(); |
| 496 cur = cur.Append(FILE_PATH_LITERAL("Default Apps")); | 503 cur = cur.Append(FILE_PATH_LITERAL("Default Apps")); |
| 497 #else | 504 #else |
| 498 if (!PathService::Get(chrome::DIR_APP, &cur)) | 505 if (!PathService::Get(chrome::DIR_APP, &cur)) |
| 499 return false; | 506 return false; |
| 500 cur = cur.Append(FILE_PATH_LITERAL("default_apps")); | 507 cur.Append(FILE_PATH_LITERAL("default_apps")); |
|
Nico
2013/02/11 15:47:06
Huh? Why this change? This is a bug, no? Does this
Dmitry Polukhin
2013/02/11 17:43:52
Oops... It is unintended change. I accidentally re
| |
| 501 #endif | 508 #endif |
| 502 break; | 509 break; |
| 503 | 510 |
| 504 default: | 511 default: |
| 505 return false; | 512 return false; |
| 506 } | 513 } |
| 507 | 514 |
| 508 if (create_dir && !file_util::PathExists(cur) && | 515 if (create_dir && !file_util::PathExists(cur) && |
| 509 !file_util::CreateDirectory(cur)) | 516 !file_util::CreateDirectory(cur)) |
| 510 return false; | 517 return false; |
| 511 | 518 |
| 512 *result = cur; | 519 *result = cur; |
| 513 return true; | 520 return true; |
| 514 } | 521 } |
| 515 | 522 |
| 516 // This cannot be done as a static initializer sadly since Visual Studio will | 523 // This cannot be done as a static initializer sadly since Visual Studio will |
| 517 // eliminate this object file if there is no direct entry point into it. | 524 // eliminate this object file if there is no direct entry point into it. |
| 518 void RegisterPathProvider() { | 525 void RegisterPathProvider() { |
| 519 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 526 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 520 } | 527 } |
| 521 | 528 |
| 522 } // namespace chrome | 529 } // namespace chrome |
| OLD | NEW |