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

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: use correct plugin name on OS X Created 5 years, 4 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
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
47 const base::FilePath::CharType kFlashSystemPluginName[] =
48 FILE_PATH_LITERAL("Flash Player.plugin");
61 #endif 49 #endif
62 50
63 const base::FilePath::CharType kInternalNaClPluginFileName[] = 51 const base::FilePath::CharType kInternalNaClPluginFileName[] =
64 FILE_PATH_LITERAL("internal-nacl-plugin"); 52 FILE_PATH_LITERAL("internal-nacl-plugin");
65 53
66 #if defined(OS_LINUX) 54 #if defined(OS_LINUX)
67 // The path to the external extension <id>.json files. 55 // The path to the external extension <id>.json files.
68 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ 56 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/
69 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = 57 const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
70 #if defined(GOOGLE_CHROME_BUILD) 58 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 18 matching lines...) Expand all
89 return true; 77 return true;
90 } 78 }
91 // In tests, just look in the module directory (below). 79 // In tests, just look in the module directory (below).
92 #endif 80 #endif
93 81
94 // The rest of the world expects plugins in the module directory. 82 // The rest of the world expects plugins in the module directory.
95 return PathService::Get(base::DIR_MODULE, result); 83 return PathService::Get(base::DIR_MODULE, result);
96 } 84 }
97 85
98 #if defined(OS_WIN) 86 #if defined(OS_WIN)
99 // Gets the Flash path if installed on the system. 87 // Gets the Flash path if installed on the system. |is_npapi| determines whether
100 bool GetSystemFlashDirectory(base::FilePath* out_path) { 88 // to return the NPAPI of the PPAPI version of the system plugin.
101 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kFlashRegistryRoot, KEY_READ); 89 bool GetSystemFlashFilename(base::FilePath* out_path, bool is_npapi) {
90 const wchar_t kNpapiFlashRegistryRoot[] =
91 L"SOFTWARE\\Macromedia\\FlashPlayerPlugin";
92 const wchar_t kPepperFlashRegistryRoot[] =
93 L"SOFTWARE\\Macromedia\\FlashPlayerPepper";
94 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath";
95
96 base::win::RegKey path_key(
97 HKEY_LOCAL_MACHINE,
98 is_npapi ? kNpapiFlashRegistryRoot : kPepperFlashRegistryRoot, KEY_READ);
102 base::string16 path_str; 99 base::string16 path_str;
103 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str))) 100 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str)))
104 return false; 101 return false;
105 base::FilePath plugin_path = base::FilePath(path_str).DirName();
106 102
107 *out_path = plugin_path; 103 *out_path = base::FilePath(path_str);
108 return true; 104 return true;
109 } 105 }
110 #endif 106 #endif
111 107
112 } // namespace 108 } // namespace
113 109
114 namespace chrome { 110 namespace chrome {
115 111
116 bool PathProvider(int key, base::FilePath* result) { 112 bool PathProvider(int key, base::FilePath* result) {
117 // Some keys are just aliases... 113 // Some keys are just aliases...
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 case chrome::DIR_PEPPER_FLASH_PLUGIN: 259 case chrome::DIR_PEPPER_FLASH_PLUGIN:
264 if (!GetInternalPluginsDirectory(&cur)) 260 if (!GetInternalPluginsDirectory(&cur))
265 return false; 261 return false;
266 cur = cur.Append(kPepperFlashBaseDirectory); 262 cur = cur.Append(kPepperFlashBaseDirectory);
267 break; 263 break;
268 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN: 264 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN:
269 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 265 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
270 return false; 266 return false;
271 cur = cur.Append(kPepperFlashBaseDirectory); 267 cur = cur.Append(kPepperFlashBaseDirectory);
272 break; 268 break;
273 case chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN: 269 case chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN:
274 #if defined(OS_WIN) 270 #if defined(OS_WIN)
275 if (!GetSystemFlashDirectory(&cur)) 271 if (!GetSystemFlashFilename(&cur, false))
276 return false; 272 return false;
277 #elif defined(OS_MACOSX) && !defined(OS_IOS) 273 #elif defined(OS_MACOSX) && !defined(OS_IOS)
278 if (!GetLocalLibraryDirectory(&cur)) 274 if (!GetLocalLibraryDirectory(&cur))
279 return false; 275 return false;
280 cur = cur.Append(kPepperFlashSystemBaseDirectory); 276 cur = cur.Append(kPepperFlashSystemBaseDirectory);
277 cur = cur.Append(chrome::kPepperFlashPluginFilename);
281 #else 278 #else
282 // Chrome on iOS does not supports PPAPI binaries, return false. 279 // Chrome on iOS does not supports PPAPI binaries, return false.
283 // TODO(wfh): If Adobe release PPAPI binaries for Linux, add support here. 280 // TODO(wfh): If Adobe release PPAPI binaries for Linux, add support here.
284 return false; 281 return false;
285 #endif 282 #endif
286 break; 283 break;
284 case chrome::FILE_FLASH_SYSTEM_PLUGIN:
285 #if defined(OS_WIN)
286 if (!GetSystemFlashFilename(&cur, true))
287 return false;
288 #elif defined(OS_MACOSX) && !defined(OS_IOS)
289 if (!GetLocalLibraryDirectory(&cur))
290 return false;
291 cur = cur.Append(kFlashSystemBaseDirectory);
292 cur = cur.Append(kFlashSystemPluginName);
293 #else
294 // Chrome on other platforms does not supports system NPAPI binaries.
295 return false;
296 #endif
297 break;
287 case chrome::FILE_LOCAL_STATE: 298 case chrome::FILE_LOCAL_STATE:
288 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 299 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
289 return false; 300 return false;
290 cur = cur.Append(chrome::kLocalStateFilename); 301 cur = cur.Append(chrome::kLocalStateFilename);
291 break; 302 break;
292 case chrome::FILE_RECORDED_SCRIPT: 303 case chrome::FILE_RECORDED_SCRIPT:
293 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 304 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
294 return false; 305 return false;
295 cur = cur.Append(FILE_PATH_LITERAL("script.log")); 306 cur = cur.Append(FILE_PATH_LITERAL("script.log"));
296 break; 307 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: 308 case chrome::FILE_PEPPER_FLASH_PLUGIN:
303 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &cur)) 309 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &cur))
304 return false; 310 return false;
305 cur = cur.Append(chrome::kPepperFlashPluginFilename); 311 cur = cur.Append(chrome::kPepperFlashPluginFilename);
306 break; 312 break;
307 // TODO(teravest): Remove this case once the internal NaCl plugin is gone. 313 // 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 314 // We currently need a path here to look up whether the plugin is disabled
309 // and what its permissions are. 315 // and what its permissions are.
310 case chrome::FILE_NACL_PLUGIN: 316 case chrome::FILE_NACL_PLUGIN:
311 if (!GetInternalPluginsDirectory(&cur)) 317 if (!GetInternalPluginsDirectory(&cur))
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 588
583 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { 589 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) {
584 g_invalid_specified_user_data_dir.Get() = user_data_dir; 590 g_invalid_specified_user_data_dir.Get() = user_data_dir;
585 } 591 }
586 592
587 const base::FilePath& GetInvalidSpecifiedUserDataDir() { 593 const base::FilePath& GetInvalidSpecifiedUserDataDir() {
588 return g_invalid_specified_user_data_dir.Get(); 594 return g_invalid_specified_user_data_dir.Get();
589 } 595 }
590 596
591 } // namespace chrome 597 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698