| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // The path to the external extension <id>.json files. | 88 // The path to the external extension <id>.json files. |
| 89 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ | 89 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ |
| 90 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = | 90 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = |
| 91 #if defined(GOOGLE_CHROME_BUILD) | 91 #if defined(GOOGLE_CHROME_BUILD) |
| 92 FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); | 92 FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); |
| 93 #else | 93 #else |
| 94 FILE_PATH_LITERAL("/usr/share/chromium/extensions"); | 94 FILE_PATH_LITERAL("/usr/share/chromium/extensions"); |
| 95 #endif // defined(GOOGLE_CHROME_BUILD) | 95 #endif // defined(GOOGLE_CHROME_BUILD) |
| 96 #endif // defined(OS_LINUX) | 96 #endif // defined(OS_LINUX) |
| 97 | 97 |
| 98 #if defined(OS_CHROMEOS) | |
| 99 | |
| 100 const base::FilePath::CharType kDefaultAppOrderFileName[] = | |
| 101 #if defined(GOOGLE_CHROME_BUILD) | |
| 102 FILE_PATH_LITERAL("/usr/share/google-chrome/default_app_order.json"); | |
| 103 #else | |
| 104 FILE_PATH_LITERAL("/usr/share/chromium/default_app_order.json"); | |
| 105 #endif // defined(GOOGLE_CHROME_BUILD) | |
| 106 | |
| 107 const base::FilePath::CharType kDefaultUserPolicyKeysDir[] = | |
| 108 FILE_PATH_LITERAL("/var/run/user_policy"); | |
| 109 | |
| 110 const base::FilePath::CharType kOwnerKeyFileName[] = | |
| 111 FILE_PATH_LITERAL("/var/lib/whitelist/owner.key"); | |
| 112 | |
| 113 const base::FilePath::CharType kInstallAttributesFileName[] = | |
| 114 FILE_PATH_LITERAL("/var/run/lockbox/install_attributes.pb"); | |
| 115 | |
| 116 const base::FilePath::CharType kUptimeFileName[] = | |
| 117 FILE_PATH_LITERAL("/proc/uptime"); | |
| 118 | |
| 119 const base::FilePath::CharType kUpdateRebootNeededUptimeFile[] = | |
| 120 FILE_PATH_LITERAL("/var/run/chrome/update_reboot_needed_uptime"); | |
| 121 | |
| 122 #endif // defined(OS_CHROMEOS) | |
| 123 | |
| 124 } // namespace | 98 } // namespace |
| 125 | 99 |
| 126 namespace chrome { | 100 namespace chrome { |
| 127 | 101 |
| 128 // Gets the path for internal plugins. | 102 // Gets the path for internal plugins. |
| 129 bool GetInternalPluginsDirectory(base::FilePath* result) { | 103 bool GetInternalPluginsDirectory(base::FilePath* result) { |
| 130 #if defined(OS_MACOSX) && !defined(OS_IOS) | 104 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 131 // If called from Chrome, get internal plugins from a subdirectory of the | 105 // If called from Chrome, get internal plugins from a subdirectory of the |
| 132 // framework. | 106 // framework. |
| 133 if (base::mac::AmIBundled()) { | 107 if (base::mac::AmIBundled()) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 case chrome::DIR_CHROMEOS_WALLPAPER_THUMBNAILS: | 394 case chrome::DIR_CHROMEOS_WALLPAPER_THUMBNAILS: |
| 421 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 395 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) |
| 422 return false; | 396 return false; |
| 423 cur = cur.Append(FILE_PATH_LITERAL("wallpaper_thumbnails")); | 397 cur = cur.Append(FILE_PATH_LITERAL("wallpaper_thumbnails")); |
| 424 break; | 398 break; |
| 425 case chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS: | 399 case chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS: |
| 426 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 400 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) |
| 427 return false; | 401 return false; |
| 428 cur = cur.Append(FILE_PATH_LITERAL("custom_wallpapers")); | 402 cur = cur.Append(FILE_PATH_LITERAL("custom_wallpapers")); |
| 429 break; | 403 break; |
| 430 case chrome::FILE_DEFAULT_APP_ORDER: | |
| 431 cur = base::FilePath(kDefaultAppOrderFileName); | |
| 432 break; | |
| 433 case chrome::DIR_USER_POLICY_KEYS: | |
| 434 cur = base::FilePath(kDefaultUserPolicyKeysDir); | |
| 435 break; | |
| 436 case chrome::FILE_OWNER_KEY: | |
| 437 cur = base::FilePath(kOwnerKeyFileName); | |
| 438 break; | |
| 439 case chrome::FILE_INSTALL_ATTRIBUTES: | |
| 440 cur = base::FilePath(kInstallAttributesFileName); | |
| 441 break; | |
| 442 case chrome::FILE_UPTIME: | |
| 443 cur = base::FilePath(kUptimeFileName); | |
| 444 break; | |
| 445 case chrome::FILE_UPDATE_REBOOT_NEEDED_UPTIME: | |
| 446 cur = base::FilePath(kUpdateRebootNeededUptimeFile); | |
| 447 break; | |
| 448 #endif | 404 #endif |
| 449 #if defined(ENABLE_MANAGED_USERS) | 405 #if defined(ENABLE_MANAGED_USERS) |
| 450 case chrome::DIR_MANAGED_USERS_DEFAULT_APPS: | 406 case chrome::DIR_MANAGED_USERS_DEFAULT_APPS: |
| 451 if (!PathService::Get(chrome::DIR_EXTERNAL_EXTENSIONS, &cur)) | 407 if (!PathService::Get(chrome::DIR_EXTERNAL_EXTENSIONS, &cur)) |
| 452 return false; | 408 return false; |
| 453 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); | 409 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); |
| 454 break; | 410 break; |
| 455 #endif | 411 #endif |
| 456 // The following are only valid in the development environment, and | 412 // The following are only valid in the development environment, and |
| 457 // will fail if executed from an installed executable (because the | 413 // will fail if executed from an installed executable (because the |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 return true; | 516 return true; |
| 561 } | 517 } |
| 562 | 518 |
| 563 // This cannot be done as a static initializer sadly since Visual Studio will | 519 // This cannot be done as a static initializer sadly since Visual Studio will |
| 564 // eliminate this object file if there is no direct entry point into it. | 520 // eliminate this object file if there is no direct entry point into it. |
| 565 void RegisterPathProvider() { | 521 void RegisterPathProvider() { |
| 566 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 522 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 567 } | 523 } |
| 568 | 524 |
| 569 } // namespace chrome | 525 } // namespace chrome |
| OLD | NEW |