| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 13 #include "base/version.h" | 13 #include "base/version.h" |
| 14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/chrome_paths_internal.h" | 15 #include "chrome/common/chrome_paths_internal.h" |
| 16 #include "ui/base/ui_base_paths.h" |
| 16 | 17 |
| 17 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
| 18 #include "base/mac/mac_util.h" | 19 #include "base/mac/mac_util.h" |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 // File name of the internal Flash plugin on different platforms. | 24 // File name of the internal Flash plugin on different platforms. |
| 24 const FilePath::CharType kInternalFlashPluginFileName[] = | 25 const FilePath::CharType kInternalFlashPluginFileName[] = |
| 25 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 break; | 306 break; |
| 306 #endif | 307 #endif |
| 307 case chrome::FILE_RESOURCES_PACK: | 308 case chrome::FILE_RESOURCES_PACK: |
| 308 #if defined(OS_MACOSX) | 309 #if defined(OS_MACOSX) |
| 309 if (base::mac::AmIBundled()) { | 310 if (base::mac::AmIBundled()) { |
| 310 cur = base::mac::FrameworkBundlePath(); | 311 cur = base::mac::FrameworkBundlePath(); |
| 311 cur = cur.Append(FILE_PATH_LITERAL("Resources")) | 312 cur = cur.Append(FILE_PATH_LITERAL("Resources")) |
| 312 .Append(FILE_PATH_LITERAL("resources.pak")); | 313 .Append(FILE_PATH_LITERAL("resources.pak")); |
| 313 break; | 314 break; |
| 314 } | 315 } |
| 315 // If we're not bundled on mac, resources.pak should be next to the | 316 #elif defined(OS_ANDROID) |
| 316 // binary (e.g., for unit tests). | 317 if (!PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &cur)) |
| 317 #endif | 318 return false; |
| 319 #else |
| 320 // If we're not bundled on mac or Android, resources.pak should be next |
| 321 // to the binary (e.g., for unit tests). |
| 318 if (!PathService::Get(base::DIR_MODULE, &cur)) | 322 if (!PathService::Get(base::DIR_MODULE, &cur)) |
| 319 return false; | 323 return false; |
| 324 #endif |
| 320 cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); | 325 cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); |
| 321 break; | 326 break; |
| 322 case chrome::DIR_RESOURCES_EXTENSION: | 327 case chrome::DIR_RESOURCES_EXTENSION: |
| 323 if (!PathService::Get(base::DIR_MODULE, &cur)) | 328 if (!PathService::Get(base::DIR_MODULE, &cur)) |
| 324 return false; | 329 return false; |
| 325 cur = cur.Append(FILE_PATH_LITERAL("resources")) | 330 cur = cur.Append(FILE_PATH_LITERAL("resources")) |
| 326 .Append(FILE_PATH_LITERAL("extension")); | 331 .Append(FILE_PATH_LITERAL("extension")); |
| 327 break; | 332 break; |
| 328 #if defined(OS_CHROMEOS) | 333 #if defined(OS_CHROMEOS) |
| 329 case chrome::DIR_CHROMEOS_WALLPAPERS: | 334 case chrome::DIR_CHROMEOS_WALLPAPERS: |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 return true; | 444 return true; |
| 440 } | 445 } |
| 441 | 446 |
| 442 // This cannot be done as a static initializer sadly since Visual Studio will | 447 // This cannot be done as a static initializer sadly since Visual Studio will |
| 443 // eliminate this object file if there is no direct entry point into it. | 448 // eliminate this object file if there is no direct entry point into it. |
| 444 void RegisterPathProvider() { | 449 void RegisterPathProvider() { |
| 445 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 450 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 446 } | 451 } |
| 447 | 452 |
| 448 } // namespace chrome | 453 } // namespace chrome |
| OLD | NEW |