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

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

Issue 1867573002: Remove code to locate the NPAPI Flash plugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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') | no next file » | 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 25 matching lines...) Expand all
36 36
37 namespace { 37 namespace {
38 38
39 // The Pepper Flash plugins are in a directory with this name. 39 // The Pepper Flash plugins are in a directory with this name.
40 const base::FilePath::CharType kPepperFlashBaseDirectory[] = 40 const base::FilePath::CharType kPepperFlashBaseDirectory[] =
41 FILE_PATH_LITERAL("PepperFlash"); 41 FILE_PATH_LITERAL("PepperFlash");
42 42
43 #if defined(OS_MACOSX) 43 #if defined(OS_MACOSX)
44 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] = 44 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] =
45 FILE_PATH_LITERAL("Internet Plug-Ins/PepperFlashPlayer"); 45 FILE_PATH_LITERAL("Internet Plug-Ins/PepperFlashPlayer");
46 const base::FilePath::CharType kFlashSystemBaseDirectory[] =
47 FILE_PATH_LITERAL("Internet Plug-Ins");
48 const base::FilePath::CharType kFlashSystemPluginName[] =
49 FILE_PATH_LITERAL("Flash Player.plugin");
50 #endif 46 #endif
51 47
52 const base::FilePath::CharType kInternalNaClPluginFileName[] = 48 const base::FilePath::CharType kInternalNaClPluginFileName[] =
53 FILE_PATH_LITERAL("internal-nacl-plugin"); 49 FILE_PATH_LITERAL("internal-nacl-plugin");
54 50
55 #if defined(OS_LINUX) 51 #if defined(OS_LINUX)
56 // The path to the external extension <id>.json files. 52 // The path to the external extension <id>.json files.
57 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ 53 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/
58 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = 54 const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
59 #if defined(GOOGLE_CHROME_BUILD) 55 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 23 matching lines...) Expand all
83 return true; 79 return true;
84 } 80 }
85 // In tests, just look in the module directory (below). 81 // In tests, just look in the module directory (below).
86 #endif 82 #endif
87 83
88 // The rest of the world expects plugins in the module directory. 84 // The rest of the world expects plugins in the module directory.
89 return PathService::Get(base::DIR_MODULE, result); 85 return PathService::Get(base::DIR_MODULE, result);
90 } 86 }
91 87
92 #if defined(OS_WIN) 88 #if defined(OS_WIN)
93 // Gets the Flash path if installed on the system. |is_npapi| determines whether 89 // Gets the Pepper Flash path if installed on the system.
94 // to return the NPAPI of the PPAPI version of the system plugin. 90 bool GetSystemFlashFilename(base::FilePath* out_path) {
95 bool GetSystemFlashFilename(base::FilePath* out_path, bool is_npapi) {
96 const wchar_t kNpapiFlashRegistryRoot[] =
97 L"SOFTWARE\\Macromedia\\FlashPlayerPlugin";
98 const wchar_t kPepperFlashRegistryRoot[] = 91 const wchar_t kPepperFlashRegistryRoot[] =
99 L"SOFTWARE\\Macromedia\\FlashPlayerPepper"; 92 L"SOFTWARE\\Macromedia\\FlashPlayerPepper";
100 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath"; 93 const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath";
101 94
102 base::win::RegKey path_key( 95 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kPepperFlashRegistryRoot,
103 HKEY_LOCAL_MACHINE, 96 KEY_READ);
104 is_npapi ? kNpapiFlashRegistryRoot : kPepperFlashRegistryRoot, KEY_READ);
105 base::string16 path_str; 97 base::string16 path_str;
106 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str))) 98 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str)))
107 return false; 99 return false;
108 100
109 *out_path = base::FilePath(path_str); 101 *out_path = base::FilePath(path_str);
110 return true; 102 return true;
111 } 103 }
112 #endif 104 #endif
113 105
114 } // namespace 106 } // namespace
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return false; 261 return false;
270 cur = cur.Append(kPepperFlashBaseDirectory); 262 cur = cur.Append(kPepperFlashBaseDirectory);
271 break; 263 break;
272 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN: 264 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN:
273 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 265 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
274 return false; 266 return false;
275 cur = cur.Append(kPepperFlashBaseDirectory); 267 cur = cur.Append(kPepperFlashBaseDirectory);
276 break; 268 break;
277 case chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN: 269 case chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN:
278 #if defined(OS_WIN) 270 #if defined(OS_WIN)
279 if (!GetSystemFlashFilename(&cur, false)) 271 if (!GetSystemFlashFilename(&cur))
280 return false; 272 return false;
281 #elif defined(OS_MACOSX) 273 #elif defined(OS_MACOSX)
282 if (!GetLocalLibraryDirectory(&cur)) 274 if (!GetLocalLibraryDirectory(&cur))
283 return false; 275 return false;
284 cur = cur.Append(kPepperFlashSystemBaseDirectory); 276 cur = cur.Append(kPepperFlashSystemBaseDirectory);
285 cur = cur.Append(chrome::kPepperFlashPluginFilename); 277 cur = cur.Append(chrome::kPepperFlashPluginFilename);
286 #else 278 #else
287 // Chrome on iOS does not supports PPAPI binaries, return false. 279 // Chrome on iOS does not supports PPAPI binaries, return false.
288 // 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.
289 return false; 281 return false;
290 #endif 282 #endif
291 break; 283 break;
292 case chrome::FILE_FLASH_SYSTEM_PLUGIN:
293 #if defined(OS_WIN)
294 if (!GetSystemFlashFilename(&cur, true))
295 return false;
296 #elif defined(OS_MACOSX)
297 if (!GetLocalLibraryDirectory(&cur))
298 return false;
299 cur = cur.Append(kFlashSystemBaseDirectory);
300 cur = cur.Append(kFlashSystemPluginName);
301 #else
302 // Chrome on other platforms does not supports system NPAPI binaries.
303 return false;
304 #endif
305 break;
306 case chrome::FILE_LOCAL_STATE: 284 case chrome::FILE_LOCAL_STATE:
307 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 285 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
308 return false; 286 return false;
309 cur = cur.Append(chrome::kLocalStateFilename); 287 cur = cur.Append(chrome::kLocalStateFilename);
310 break; 288 break;
311 case chrome::FILE_RECORDED_SCRIPT: 289 case chrome::FILE_RECORDED_SCRIPT:
312 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 290 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
313 return false; 291 return false;
314 cur = cur.Append(FILE_PATH_LITERAL("script.log")); 292 cur = cur.Append(FILE_PATH_LITERAL("script.log"));
315 break; 293 break;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 568
591 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { 569 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) {
592 g_invalid_specified_user_data_dir.Get() = user_data_dir; 570 g_invalid_specified_user_data_dir.Get() = user_data_dir;
593 } 571 }
594 572
595 const base::FilePath& GetInvalidSpecifiedUserDataDir() { 573 const base::FilePath& GetInvalidSpecifiedUserDataDir() {
596 return g_invalid_specified_user_data_dir.Get(); 574 return g_invalid_specified_user_data_dir.Get();
597 } 575 }
598 576
599 } // namespace chrome 577 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698