Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: chrome/common/chrome_paths.cc

Issue 1255943002: One-time migration of NPAPI Flash to PPAPI Flash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 #endif 28 #endif
29 29
30 #if defined(OS_WIN) 30 #if defined(OS_WIN)
31 #include "base/win/registry.h" 31 #include "base/win/registry.h"
32 #endif 32 #endif
33 33
34 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 34 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
35 35
36 namespace { 36 namespace {
37 37
38 #if defined(OS_WIN)
39 const wchar_t kFlashRegistryRoot[] = L"SOFTWARE\\Macromedia\\FlashPlayerPepper";
40
41 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath";
42 #endif
43
44 // File name of the internal Flash plugin on different platforms.
45 const base::FilePath::CharType kInternalFlashPluginFileName[] =
46 #if defined(OS_MACOSX)
47 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin");
48 #elif defined(OS_WIN)
49 FILE_PATH_LITERAL("gcswf32.dll");
50 #else // OS_LINUX, etc.
51 FILE_PATH_LITERAL("libgcflashplayer.so");
52 #endif
53
54 // The Pepper Flash plugins are in a directory with this name. 38 // The Pepper Flash plugins are in a directory with this name.
55 const base::FilePath::CharType kPepperFlashBaseDirectory[] = 39 const base::FilePath::CharType kPepperFlashBaseDirectory[] =
56 FILE_PATH_LITERAL("PepperFlash"); 40 FILE_PATH_LITERAL("PepperFlash");
57 41
58 #if defined(OS_MACOSX) && !defined(OS_IOS) 42 #if defined(OS_MACOSX) && !defined(OS_IOS)
59 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] = 43 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] =
60 FILE_PATH_LITERAL("Internet Plug-Ins/PepperFlashPlayer"); 44 FILE_PATH_LITERAL("Internet Plug-Ins/PepperFlashPlayer");
45 const base::FilePath::CharType kFlashSystemBaseDirectory[] =
46 FILE_PATH_LITERAL("Internet Plug-Ins");
61 #endif 47 #endif
62 48
63 const base::FilePath::CharType kInternalNaClPluginFileName[] = 49 const base::FilePath::CharType kInternalNaClPluginFileName[] =
64 FILE_PATH_LITERAL("internal-nacl-plugin"); 50 FILE_PATH_LITERAL("internal-nacl-plugin");
65 51
66 #if defined(OS_LINUX) 52 #if defined(OS_LINUX)
67 // The path to the external extension <id>.json files. 53 // The path to the external extension <id>.json files.
68 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ 54 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/
69 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = 55 const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
70 #if defined(GOOGLE_CHROME_BUILD) 56 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 18 matching lines...) Expand all
89 return true; 75 return true;
90 } 76 }
91 // In tests, just look in the module directory (below). 77 // In tests, just look in the module directory (below).
92 #endif 78 #endif
93 79
94 // The rest of the world expects plugins in the module directory. 80 // The rest of the world expects plugins in the module directory.
95 return PathService::Get(base::DIR_MODULE, result); 81 return PathService::Get(base::DIR_MODULE, result);
96 } 82 }
97 83
98 #if defined(OS_WIN) 84 #if defined(OS_WIN)
99 // Gets the Flash path if installed on the system. 85 // Gets the Flash path if installed on the system. |is_npapi| determines whether
100 bool GetSystemFlashDirectory(base::FilePath* out_path) { 86 // to return the NPAPI of the PPAPI version of the system plugin.
101 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kFlashRegistryRoot, KEY_READ); 87 bool GetSystemFlashFilename(base::FilePath* out_path, bool is_npapi) {
88 const wchar_t kNpapiFlashRegistryRoot[] =
89 L"SOFTWARE\\Macromedia\\FlashPlayerPlugin";
90 const wchar_t kPepperFlashRegistryRoot[] =
91 L"SOFTWARE\\Macromedia\\FlashPlayerPepper";
92 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath";
93
94 base::win::RegKey path_key(
95 HKEY_LOCAL_MACHINE,
96 is_npapi ? kNpapiFlashRegistryRoot : kPepperFlashRegistryRoot, KEY_READ);
102 base::string16 path_str; 97 base::string16 path_str;
103 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str))) 98 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str)))
104 return false; 99 return false;
105 base::FilePath plugin_path = base::FilePath(path_str).DirName();
106 100
107 *out_path = plugin_path; 101 *out_path = base::FilePath(path_str);
108 return true; 102 return true;
109 } 103 }
110 #endif 104 #endif
111 105
112 } // namespace 106 } // namespace
113 107
114 namespace chrome { 108 namespace chrome {
115 109
116 bool PathProvider(int key, base::FilePath* result) { 110 bool PathProvider(int key, base::FilePath* result) {
117 // Some keys are just aliases... 111 // Some keys are just aliases...
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 case chrome::DIR_PEPPER_FLASH_PLUGIN: 257 case chrome::DIR_PEPPER_FLASH_PLUGIN:
264 if (!GetInternalPluginsDirectory(&cur)) 258 if (!GetInternalPluginsDirectory(&cur))
265 return false; 259 return false;
266 cur = cur.Append(kPepperFlashBaseDirectory); 260 cur = cur.Append(kPepperFlashBaseDirectory);
267 break; 261 break;
268 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN: 262 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN:
269 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 263 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
270 return false; 264 return false;
271 cur = cur.Append(kPepperFlashBaseDirectory); 265 cur = cur.Append(kPepperFlashBaseDirectory);
272 break; 266 break;
273 case chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN: 267 case chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN:
274 #if defined(OS_WIN) 268 #if defined(OS_WIN)
275 if (!GetSystemFlashDirectory(&cur)) 269 if (!GetSystemFlashFilename(&cur, false))
276 return false; 270 return false;
277 #elif defined(OS_MACOSX) && !defined(OS_IOS) 271 #elif defined(OS_MACOSX) && !defined(OS_IOS)
278 if (!GetLocalLibraryDirectory(&cur)) 272 if (!GetLocalLibraryDirectory(&cur))
279 return false; 273 return false;
280 cur = cur.Append(kPepperFlashSystemBaseDirectory); 274 cur = cur.Append(kPepperFlashSystemBaseDirectory);
275 cur = cur.Append(chrome::kPepperFlashPluginFilename);
281 #else 276 #else
282 // Chrome on iOS does not supports PPAPI binaries, return false. 277 // Chrome on iOS does not supports PPAPI binaries, return false.
283 // TODO(wfh): If Adobe release PPAPI binaries for Linux, add support here. 278 // TODO(wfh): If Adobe release PPAPI binaries for Linux, add support here.
279 return false;
280 #endif
281 break;
282 case chrome::FILE_FLASH_SYSTEM_PLUGIN:
283 #if defined(OS_WIN)
284 if (!GetSystemFlashFilename(&cur, true))
285 return false;
286 #elif defined(OS_MACOSX) && !defined(OS_IOS)
287 if (!GetLocalLibraryDirectory(&cur))
288 return false;
289 cur = cur.Append(kFlashSystemBaseDirectory);
290 cur = cur.Append(chrome::kPepperFlashPluginFilename);
291 #else
292 // Chrome on iOS does not supports PPAPI binaries, return false.
293 // TODO(wfh): If Adobe release PPAPI binaries for Linux, add support here.
284 return false; 294 return false;
285 #endif 295 #endif
286 break; 296 break;
287 case chrome::FILE_LOCAL_STATE: 297 case chrome::FILE_LOCAL_STATE:
288 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 298 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
289 return false; 299 return false;
290 cur = cur.Append(chrome::kLocalStateFilename); 300 cur = cur.Append(chrome::kLocalStateFilename);
291 break; 301 break;
292 case chrome::FILE_RECORDED_SCRIPT: 302 case chrome::FILE_RECORDED_SCRIPT:
293 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 303 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
294 return false; 304 return false;
295 cur = cur.Append(FILE_PATH_LITERAL("script.log")); 305 cur = cur.Append(FILE_PATH_LITERAL("script.log"));
296 break; 306 break;
297 case chrome::FILE_FLASH_PLUGIN:
298 if (!GetInternalPluginsDirectory(&cur))
299 return false;
300 cur = cur.Append(kInternalFlashPluginFileName);
301 break;
302 case chrome::FILE_PEPPER_FLASH_PLUGIN: 307 case chrome::FILE_PEPPER_FLASH_PLUGIN:
303 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &cur)) 308 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &cur))
304 return false; 309 return false;
305 cur = cur.Append(chrome::kPepperFlashPluginFilename); 310 cur = cur.Append(chrome::kPepperFlashPluginFilename);
306 break; 311 break;
307 // TODO(teravest): Remove this case once the internal NaCl plugin is gone. 312 // TODO(teravest): Remove this case once the internal NaCl plugin is gone.
308 // We currently need a path here to look up whether the plugin is disabled 313 // We currently need a path here to look up whether the plugin is disabled
309 // and what its permissions are. 314 // and what its permissions are.
310 case chrome::FILE_NACL_PLUGIN: 315 case chrome::FILE_NACL_PLUGIN:
311 if (!GetInternalPluginsDirectory(&cur)) 316 if (!GetInternalPluginsDirectory(&cur))
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 587
583 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { 588 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) {
584 g_invalid_specified_user_data_dir.Get() = user_data_dir; 589 g_invalid_specified_user_data_dir.Get() = user_data_dir;
585 } 590 }
586 591
587 const base::FilePath& GetInvalidSpecifiedUserDataDir() { 592 const base::FilePath& GetInvalidSpecifiedUserDataDir() {
588 return g_invalid_specified_user_data_dir.Get(); 593 return g_invalid_specified_user_data_dir.Get();
589 } 594 }
590 595
591 } // namespace chrome 596 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698