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

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

Issue 893823002: Register system Pepper Flash plugin if no packaged Pepper plugin is found. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments. read location of pepperflash from registry. Created 5 years, 10 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/pepper_flash.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"
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" 23 #include "base/base_paths_android.h"
24 #endif 24 #endif
25 25
26 #if defined(OS_MACOSX) 26 #if defined(OS_MACOSX)
27 #include "base/mac/foundation_util.h" 27 #include "base/mac/foundation_util.h"
28 #endif 28 #endif
29 29
30 #if defined(OS_WIN)
31 #include "base/win/registry.h"
32 #endif
33
30 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 34 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
31 35
32 namespace { 36 namespace {
33 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
34 // File name of the internal Flash plugin on different platforms. 44 // File name of the internal Flash plugin on different platforms.
35 const base::FilePath::CharType kInternalFlashPluginFileName[] = 45 const base::FilePath::CharType kInternalFlashPluginFileName[] =
36 #if defined(OS_MACOSX) 46 #if defined(OS_MACOSX)
37 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin"); 47 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin");
38 #elif defined(OS_WIN) 48 #elif defined(OS_WIN)
39 FILE_PATH_LITERAL("gcswf32.dll"); 49 FILE_PATH_LITERAL("gcswf32.dll");
40 #else // OS_LINUX, etc. 50 #else // OS_LINUX, etc.
41 FILE_PATH_LITERAL("libgcflashplayer.so"); 51 FILE_PATH_LITERAL("libgcflashplayer.so");
42 #endif 52 #endif
43 53
44 // The Pepper Flash plugins are in a directory with this name. 54 // The Pepper Flash plugins are in a directory with this name.
45 const base::FilePath::CharType kPepperFlashBaseDirectory[] = 55 const base::FilePath::CharType kPepperFlashBaseDirectory[] =
46 FILE_PATH_LITERAL("PepperFlash"); 56 FILE_PATH_LITERAL("PepperFlash");
47 57
48 #if defined(OS_WIN) 58 #if defined(OS_WIN)
49 const base::FilePath::CharType kPepperFlashDebuggerBaseDirectory[] = 59 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] =
50 FILE_PATH_LITERAL("Macromed\\Flash"); 60 FILE_PATH_LITERAL("Macromed\\Flash");
61 #elif defined(OS_MACOSX)
62 const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] =
63 FILE_PATH_LITERAL("Internet Plug-Ins/PepperFlashPlayer");
51 #endif 64 #endif
52 65
53 const base::FilePath::CharType kInternalNaClPluginFileName[] = 66 const base::FilePath::CharType kInternalNaClPluginFileName[] =
54 FILE_PATH_LITERAL("internal-nacl-plugin"); 67 FILE_PATH_LITERAL("internal-nacl-plugin");
55 68
56 const base::FilePath::CharType kEffectsPluginFileName[] = 69 const base::FilePath::CharType kEffectsPluginFileName[] =
57 #if defined(OS_WIN) 70 #if defined(OS_WIN)
58 FILE_PATH_LITERAL("pepper/libppeffects.dll"); 71 FILE_PATH_LITERAL("pepper/libppeffects.dll");
59 #elif defined(OS_MACOSX) 72 #elif defined(OS_MACOSX)
60 FILE_PATH_LITERAL("pepper/libppeffects.plugin"); 73 FILE_PATH_LITERAL("pepper/libppeffects.plugin");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 *result = result->Append("Internet Plug-Ins"); 110 *result = result->Append("Internet Plug-Ins");
98 return true; 111 return true;
99 } 112 }
100 // In tests, just look in the module directory (below). 113 // In tests, just look in the module directory (below).
101 #endif 114 #endif
102 115
103 // The rest of the world expects plugins in the module directory. 116 // The rest of the world expects plugins in the module directory.
104 return PathService::Get(base::DIR_MODULE, result); 117 return PathService::Get(base::DIR_MODULE, result);
105 } 118 }
106 119
120 #if defined(OS_WIN)
121 // Gets the Flash path if installed on the system.
122 bool GetSystemFlashDirectory(base::FilePath* out_path) {
123 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kFlashRegistryRoot, KEY_READ);
124 base::string16 path_str;
125 if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str)))
126 return false;
127 base::FilePath plugin_path = base::FilePath(path_str).DirName();
128
129 if (!base::PathExists(plugin_path))
130 return false;
131
132 *out_path = plugin_path;
133 return true;
134 }
135 #endif
136
107 } // namespace 137 } // namespace
108 138
109 namespace chrome { 139 namespace chrome {
110 140
111 bool PathProvider(int key, base::FilePath* result) { 141 bool PathProvider(int key, base::FilePath* result) {
112 // Some keys are just aliases... 142 // Some keys are just aliases...
113 switch (key) { 143 switch (key) {
114 case chrome::DIR_APP: 144 case chrome::DIR_APP:
115 return PathService::Get(base::DIR_MODULE, result); 145 return PathService::Get(base::DIR_MODULE, result);
116 case chrome::DIR_LOGS: 146 case chrome::DIR_LOGS:
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 case chrome::DIR_PEPPER_FLASH_PLUGIN: 274 case chrome::DIR_PEPPER_FLASH_PLUGIN:
245 if (!GetInternalPluginsDirectory(&cur)) 275 if (!GetInternalPluginsDirectory(&cur))
246 return false; 276 return false;
247 cur = cur.Append(kPepperFlashBaseDirectory); 277 cur = cur.Append(kPepperFlashBaseDirectory);
248 break; 278 break;
249 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN: 279 case chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN:
250 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 280 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
251 return false; 281 return false;
252 cur = cur.Append(kPepperFlashBaseDirectory); 282 cur = cur.Append(kPepperFlashBaseDirectory);
253 break; 283 break;
254 case chrome::DIR_PEPPER_FLASH_DEBUGGER_PLUGIN: 284 case chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN:
255 #if defined(OS_WIN) 285 #if defined(OS_WIN)
256 if (!PathService::Get(base::DIR_SYSTEM, &cur)) 286 if (!GetSystemFlashDirectory(&cur))
257 return false; 287 return false;
258 cur = cur.Append(kPepperFlashDebuggerBaseDirectory);
259 #elif defined(OS_MACOSX) 288 #elif defined(OS_MACOSX)
260 // TODO(luken): finalize Mac OS directory paths, current consensus is 289 if (!GetLocalLibraryDirectory(&cur))
261 // around /Library/Internet Plug-Ins/PepperFlashPlayer/ 290 return false;
262 return false; 291 cur = cur.Append(kPepperFlashSystemBaseDirectory);
263 #else 292 #else
293 // TODO(wfh): If Adobe release PPAPI binaries for Linux, add support here.
264 return false; 294 return false;
265 #endif 295 #endif
266 break; 296 break;
267 case chrome::FILE_LOCAL_STATE: 297 case chrome::FILE_LOCAL_STATE:
268 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 298 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
269 return false; 299 return false;
270 cur = cur.Append(chrome::kLocalStateFilename); 300 cur = cur.Append(chrome::kLocalStateFilename);
271 break; 301 break;
272 case chrome::FILE_RECORDED_SCRIPT: 302 case chrome::FILE_RECORDED_SCRIPT:
273 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 303 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 602
573 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { 603 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) {
574 g_invalid_specified_user_data_dir.Get() = user_data_dir; 604 g_invalid_specified_user_data_dir.Get() = user_data_dir;
575 } 605 }
576 606
577 const base::FilePath& GetInvalidSpecifiedUserDataDir() { 607 const base::FilePath& GetInvalidSpecifiedUserDataDir() {
578 return g_invalid_specified_user_data_dir.Get(); 608 return g_invalid_specified_user_data_dir.Get();
579 } 609 }
580 610
581 } // namespace chrome 611 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | chrome/common/pepper_flash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698