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/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
15 #include "base/version.h" | 15 #include "base/version.h" |
16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/chrome_paths_internal.h" | 17 #include "chrome/common/chrome_paths_internal.h" |
18 #include "chrome/common/widevine_cdm_constants.h" | 18 #include "chrome/common/widevine_cdm_constants.h" |
19 #include "ui/base/ui_base_paths.h" | 19 #include "ui/base/ui_base_paths.h" |
20 | 20 |
21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
22 #include "base/android/path_utils.h" | 22 #include "base/android/path_utils.h" |
23 #include "base/base_paths_android.h" | |
24 #endif | 23 #endif |
25 | 24 |
26 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
27 #include "base/mac/foundation_util.h" | 26 #include "base/mac/foundation_util.h" |
28 #endif | 27 #endif |
29 | 28 |
30 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 29 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
31 | 30 |
32 namespace { | 31 namespace { |
33 | 32 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 case chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS: | 427 case chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS: |
429 if (!PathService::Get(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, &cur)) | 428 if (!PathService::Get(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, &cur)) |
430 return false; | 429 return false; |
431 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); | 430 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); |
432 break; | 431 break; |
433 #endif | 432 #endif |
434 // The following are only valid in the development environment, and | 433 // The following are only valid in the development environment, and |
435 // will fail if executed from an installed executable (because the | 434 // will fail if executed from an installed executable (because the |
436 // generated path won't exist). | 435 // generated path won't exist). |
437 case chrome::DIR_GEN_TEST_DATA: | 436 case chrome::DIR_GEN_TEST_DATA: |
438 #if defined(OS_ANDROID) | |
439 // On Android, our tests don't have permission to write to DIR_MODULE. | |
440 // gtest/test_runner.py pushes data to external storage. | |
441 if (!PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &cur)) | |
442 return false; | |
443 #else | |
444 if (!PathService::Get(base::DIR_MODULE, &cur)) | 437 if (!PathService::Get(base::DIR_MODULE, &cur)) |
445 return false; | 438 return false; |
446 #endif | |
447 cur = cur.Append(FILE_PATH_LITERAL("test_data")); | 439 cur = cur.Append(FILE_PATH_LITERAL("test_data")); |
448 if (!base::PathExists(cur)) // We don't want to create this. | 440 if (!base::PathExists(cur)) // We don't want to create this. |
449 return false; | 441 return false; |
450 break; | 442 break; |
451 case chrome::DIR_TEST_DATA: | 443 case chrome::DIR_TEST_DATA: |
452 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) | 444 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) |
453 return false; | 445 return false; |
454 cur = cur.Append(FILE_PATH_LITERAL("chrome")); | 446 cur = cur.Append(FILE_PATH_LITERAL("chrome")); |
455 cur = cur.Append(FILE_PATH_LITERAL("test")); | 447 cur = cur.Append(FILE_PATH_LITERAL("test")); |
456 cur = cur.Append(FILE_PATH_LITERAL("data")); | 448 cur = cur.Append(FILE_PATH_LITERAL("data")); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 596 |
605 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { | 597 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { |
606 g_invalid_specified_user_data_dir.Get() = user_data_dir; | 598 g_invalid_specified_user_data_dir.Get() = user_data_dir; |
607 } | 599 } |
608 | 600 |
609 const base::FilePath& GetInvalidSpecifiedUserDataDir() { | 601 const base::FilePath& GetInvalidSpecifiedUserDataDir() { |
610 return g_invalid_specified_user_data_dir.Get(); | 602 return g_invalid_specified_user_data_dir.Get(); |
611 } | 603 } |
612 | 604 |
613 } // namespace chrome | 605 } // namespace chrome |
OLD | NEW |