| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // The path to the external extension <id>.json files. | 85 // The path to the external extension <id>.json files. |
| 86 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ | 86 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ |
| 87 const char kFilepathSinglePrefExtensions[] = | 87 const char kFilepathSinglePrefExtensions[] = |
| 88 #if defined(GOOGLE_CHROME_BUILD) | 88 #if defined(GOOGLE_CHROME_BUILD) |
| 89 FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); | 89 FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); |
| 90 #else | 90 #else |
| 91 FILE_PATH_LITERAL("/usr/share/chromium/extensions"); | 91 FILE_PATH_LITERAL("/usr/share/chromium/extensions"); |
| 92 #endif // defined(GOOGLE_CHROME_BUILD) | 92 #endif // defined(GOOGLE_CHROME_BUILD) |
| 93 #endif // defined(OS_LINUX) | 93 #endif // defined(OS_LINUX) |
| 94 | 94 |
| 95 #if defined(OS_CHROMEOS) |
| 96 const char kDefaultAppOrderFileName[] = |
| 97 #if defined(GOOGLE_CHROME_BUILD) |
| 98 FILE_PATH_LITERAL("/usr/share/google-chrome/default_app_order.json"); |
| 99 #else |
| 100 FILE_PATH_LITERAL("/usr/share/chromium/default_app_order.json"); |
| 101 #endif // defined(GOOGLE_CHROME_BUILD) |
| 102 #endif // defined(OS_CHROMEOS) |
| 103 |
| 95 } // namespace | 104 } // namespace |
| 96 | 105 |
| 97 namespace chrome { | 106 namespace chrome { |
| 98 | 107 |
| 99 // Gets the path for internal plugins. | 108 // Gets the path for internal plugins. |
| 100 bool GetInternalPluginsDirectory(FilePath* result) { | 109 bool GetInternalPluginsDirectory(FilePath* result) { |
| 101 #if defined(OS_MACOSX) | 110 #if defined(OS_MACOSX) |
| 102 // If called from Chrome, get internal plugins from a subdirectory of the | 111 // If called from Chrome, get internal plugins from a subdirectory of the |
| 103 // framework. | 112 // framework. |
| 104 if (base::mac::AmIBundled()) { | 113 if (base::mac::AmIBundled()) { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 return false; | 369 return false; |
| 361 cur = cur.Append(FILE_PATH_LITERAL("resources")) | 370 cur = cur.Append(FILE_PATH_LITERAL("resources")) |
| 362 .Append(FILE_PATH_LITERAL("extension")); | 371 .Append(FILE_PATH_LITERAL("extension")); |
| 363 break; | 372 break; |
| 364 #if defined(OS_CHROMEOS) | 373 #if defined(OS_CHROMEOS) |
| 365 case chrome::DIR_CHROMEOS_WALLPAPERS: | 374 case chrome::DIR_CHROMEOS_WALLPAPERS: |
| 366 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 375 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) |
| 367 return false; | 376 return false; |
| 368 cur = cur.Append(FILE_PATH_LITERAL("wallpapers")); | 377 cur = cur.Append(FILE_PATH_LITERAL("wallpapers")); |
| 369 break; | 378 break; |
| 379 case chrome::FILE_DEFAULT_APP_ORDER: |
| 380 cur = FilePath(FILE_PATH_LITERAL(kDefaultAppOrderFileName)); |
| 381 break; |
| 370 #endif | 382 #endif |
| 371 // The following are only valid in the development environment, and | 383 // The following are only valid in the development environment, and |
| 372 // will fail if executed from an installed executable (because the | 384 // will fail if executed from an installed executable (because the |
| 373 // generated path won't exist). | 385 // generated path won't exist). |
| 374 case chrome::DIR_GEN_TEST_DATA: | 386 case chrome::DIR_GEN_TEST_DATA: |
| 375 if (!PathService::Get(base::DIR_MODULE, &cur)) | 387 if (!PathService::Get(base::DIR_MODULE, &cur)) |
| 376 return false; | 388 return false; |
| 377 cur = cur.Append(FILE_PATH_LITERAL("test_data")); | 389 cur = cur.Append(FILE_PATH_LITERAL("test_data")); |
| 378 if (!file_util::PathExists(cur)) // We don't want to create this. | 390 if (!file_util::PathExists(cur)) // We don't want to create this. |
| 379 return false; | 391 return false; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 return true; | 487 return true; |
| 476 } | 488 } |
| 477 | 489 |
| 478 // This cannot be done as a static initializer sadly since Visual Studio will | 490 // This cannot be done as a static initializer sadly since Visual Studio will |
| 479 // eliminate this object file if there is no direct entry point into it. | 491 // eliminate this object file if there is no direct entry point into it. |
| 480 void RegisterPathProvider() { | 492 void RegisterPathProvider() { |
| 481 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 493 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 482 } | 494 } |
| 483 | 495 |
| 484 } // namespace chrome | 496 } // namespace chrome |
| OLD | NEW |