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/files/file_util.h" | 7 #include "base/files/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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 *result = result->Append("Internet Plug-Ins"); | 78 *result = result->Append("Internet Plug-Ins"); |
79 return true; | 79 return true; |
80 } | 80 } |
81 // In tests, just look in the module directory (below). | 81 // In tests, just look in the module directory (below). |
82 #endif | 82 #endif |
83 | 83 |
84 // The rest of the world expects plugins in the module directory. | 84 // The rest of the world expects plugins in the module directory. |
85 return PathService::Get(base::DIR_MODULE, result); | 85 return PathService::Get(base::DIR_MODULE, result); |
86 } | 86 } |
87 | 87 |
88 // Gets the path for internal plugins. | |
Nico
2016/05/16 21:09:52
this comment could point that out then
waffles
2016/05/16 21:32:34
Done.
| |
89 bool GetComponentDirectory(base::FilePath* result) { | |
90 #if defined(OS_MACOSX) | |
91 // If called from Chrome, return the framework's Libraries directory. | |
92 if (base::mac::AmIBundled()) { | |
93 *result = chrome::GetFrameworkBundlePath(); | |
94 DCHECK(!result->empty()); | |
95 *result = result->Append("Libraries"); | |
96 return true; | |
97 } | |
98 // In tests, just look in the module directory (below). | |
99 #endif | |
100 | |
101 // The rest of the world expects components in the module directory. | |
102 return PathService::Get(base::DIR_MODULE, result); | |
103 } | |
104 | |
88 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
89 // Gets the Pepper Flash path if installed on the system. | 106 // Gets the Pepper Flash path if installed on the system. |
90 bool GetSystemFlashFilename(base::FilePath* out_path) { | 107 bool GetSystemFlashFilename(base::FilePath* out_path) { |
91 const wchar_t kPepperFlashRegistryRoot[] = | 108 const wchar_t kPepperFlashRegistryRoot[] = |
92 L"SOFTWARE\\Macromedia\\FlashPlayerPepper"; | 109 L"SOFTWARE\\Macromedia\\FlashPlayerPepper"; |
93 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath"; | 110 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath"; |
94 | 111 |
95 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kPepperFlashRegistryRoot, | 112 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kPepperFlashRegistryRoot, |
96 KEY_READ); | 113 KEY_READ); |
97 base::string16 path_str; | 114 base::string16 path_str; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 if (!PathService::Get(base::DIR_EXE, &cur)) | 266 if (!PathService::Get(base::DIR_EXE, &cur)) |
250 return false; | 267 return false; |
251 #endif | 268 #endif |
252 cur = cur.Append(FILE_PATH_LITERAL("Dictionaries")); | 269 cur = cur.Append(FILE_PATH_LITERAL("Dictionaries")); |
253 create_dir = true; | 270 create_dir = true; |
254 break; | 271 break; |
255 case chrome::DIR_INTERNAL_PLUGINS: | 272 case chrome::DIR_INTERNAL_PLUGINS: |
256 if (!GetInternalPluginsDirectory(&cur)) | 273 if (!GetInternalPluginsDirectory(&cur)) |
257 return false; | 274 return false; |
258 break; | 275 break; |
276 case chrome::DIR_COMPONENTS: | |
277 if (!GetComponentDirectory(&cur)) | |
278 return false; | |
279 break; | |
259 case chrome::DIR_PEPPER_FLASH_PLUGIN: | 280 case chrome::DIR_PEPPER_FLASH_PLUGIN: |
260 if (!GetInternalPluginsDirectory(&cur)) | 281 if (!GetInternalPluginsDirectory(&cur)) |
261 return false; | 282 return false; |
262 cur = cur.Append(kPepperFlashBaseDirectory); | 283 cur = cur.Append(kPepperFlashBaseDirectory); |
263 break; | 284 break; |
264 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN: | 285 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN: |
265 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 286 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) |
266 return false; | 287 return false; |
267 cur = cur.Append(kPepperFlashBaseDirectory); | 288 cur = cur.Append(kPepperFlashBaseDirectory); |
268 break; | 289 break; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
566 | 587 |
567 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { | 588 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { |
568 g_invalid_specified_user_data_dir.Get() = user_data_dir; | 589 g_invalid_specified_user_data_dir.Get() = user_data_dir; |
569 } | 590 } |
570 | 591 |
571 const base::FilePath& GetInvalidSpecifiedUserDataDir() { | 592 const base::FilePath& GetInvalidSpecifiedUserDataDir() { |
572 return g_invalid_specified_user_data_dir.Get(); | 593 return g_invalid_specified_user_data_dir.Get(); |
573 } | 594 } |
574 | 595 |
575 } // namespace chrome | 596 } // namespace chrome |
OLD | NEW |