| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/common/plugin_list.h" | |
| 6 | |
| 7 #include <stddef.h> | |
| 8 | |
| 9 #include <set> | |
| 10 | |
| 11 #include "base/file_version_info.h" | |
| 12 #include "base/file_version_info_win.h" | |
| 13 #include "base/files/file_util.h" | |
| 14 #include "base/files/memory_mapped_file.h" | |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/path_service.h" | |
| 17 #include "base/strings/string_number_conversions.h" | |
| 18 #include "base/strings/string_split.h" | |
| 19 #include "base/strings/string_util.h" | |
| 20 #include "base/strings/utf_string_conversions.h" | |
| 21 #include "base/win/pe_image.h" | |
| 22 #include "base/win/registry.h" | |
| 23 #include "base/win/scoped_handle.h" | |
| 24 #include "base/win/windows_version.h" | |
| 25 #include "build/build_config.h" | |
| 26 #include "content/common/plugin_constants_win.h" | |
| 27 | |
| 28 namespace content { | |
| 29 namespace { | |
| 30 | |
| 31 const base::char16 kRegistryApps[] = | |
| 32 L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"; | |
| 33 const base::char16 kRegistryAcrobat[] = L"Acrobat.exe"; | |
| 34 const base::char16 kRegistryAcrobatReader[] = L"AcroRd32.exe"; | |
| 35 const base::char16 kRegistryWindowsMedia[] = L"wmplayer.exe"; | |
| 36 const base::char16 kRegistryQuickTime[] = L"QuickTimePlayer.exe"; | |
| 37 const base::char16 kRegistryPath[] = L"Path"; | |
| 38 const base::char16 kRegistryFirefoxInstalled[] = | |
| 39 L"SOFTWARE\\Mozilla\\Mozilla Firefox"; | |
| 40 const base::char16 kRegistryJava[] = | |
| 41 L"Software\\JavaSoft\\Java Runtime Environment"; | |
| 42 const base::char16 kRegistryBrowserJavaVersion[] = L"BrowserJavaVersion"; | |
| 43 const base::char16 kRegistryCurrentJavaVersion[] = L"CurrentVersion"; | |
| 44 const base::char16 kRegistryJavaHome[] = L"JavaHome"; | |
| 45 const base::char16 kJavaDeploy1[] = L"npdeploytk.dll"; | |
| 46 const base::char16 kJavaDeploy2[] = L"npdeployjava1.dll"; | |
| 47 | |
| 48 base::FilePath AppendPluginsDir(const base::FilePath& path) { | |
| 49 return path.AppendASCII("plugins"); | |
| 50 } | |
| 51 | |
| 52 // Gets the directory where the application data and libraries exist. This | |
| 53 // may be a versioned subdirectory, or it may be the same directory as the | |
| 54 // GetExeDirectory(), depending on the embedder's implementation. | |
| 55 // Path is an output parameter to receive the path. | |
| 56 void GetAppDirectory(std::set<base::FilePath>* plugin_dirs) { | |
| 57 base::FilePath app_path; | |
| 58 if (!PathService::Get(base::DIR_MODULE, &app_path)) | |
| 59 return; | |
| 60 plugin_dirs->insert(AppendPluginsDir(app_path)); | |
| 61 } | |
| 62 | |
| 63 // Gets the directory where the launching executable resides on disk. | |
| 64 // Path is an output parameter to receive the path. | |
| 65 void GetExeDirectory(std::set<base::FilePath>* plugin_dirs) { | |
| 66 base::FilePath exe_path; | |
| 67 if (!PathService::Get(base::DIR_EXE, &exe_path)) | |
| 68 return; | |
| 69 plugin_dirs->insert(AppendPluginsDir(exe_path)); | |
| 70 } | |
| 71 | |
| 72 // Gets the installed path for a registered app. | |
| 73 bool GetInstalledPath(const base::char16* app, base::FilePath* out) { | |
| 74 base::string16 reg_path(kRegistryApps); | |
| 75 reg_path.append(L"\\"); | |
| 76 reg_path.append(app); | |
| 77 | |
| 78 base::win::RegKey hkcu_key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); | |
| 79 base::string16 path; | |
| 80 // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf. | |
| 81 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && | |
| 82 hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { | |
| 83 *out = base::FilePath(path); | |
| 84 return true; | |
| 85 } else { | |
| 86 base::win::RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); | |
| 87 if (hklm_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { | |
| 88 *out = base::FilePath(path); | |
| 89 return true; | |
| 90 } | |
| 91 } | |
| 92 | |
| 93 return false; | |
| 94 } | |
| 95 | |
| 96 // Search the registry at the given path and detect plugin directories. | |
| 97 void GetPluginsInRegistryDirectory(HKEY root_key, | |
| 98 const base::string16& registry_folder, | |
| 99 REGSAM wow64_access, | |
| 100 std::set<base::FilePath>* plugin_dirs) { | |
| 101 for (base::win::RegistryKeyIterator iter( | |
| 102 root_key, registry_folder.c_str(), wow64_access); | |
| 103 iter.Valid(); | |
| 104 ++iter) { | |
| 105 // Use the registry to gather plugin across the file system. | |
| 106 base::string16 reg_path = registry_folder; | |
| 107 reg_path.append(L"\\"); | |
| 108 reg_path.append(iter.Name()); | |
| 109 base::win::RegKey key(root_key, reg_path.c_str(), KEY_READ | wow64_access); | |
| 110 | |
| 111 base::string16 path; | |
| 112 if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) | |
| 113 plugin_dirs->insert(base::FilePath(path)); | |
| 114 } | |
| 115 } | |
| 116 | |
| 117 // Enumerate through the registry key to find all installed FireFox paths. | |
| 118 // FireFox 3 beta and version 2 can coexist. See bug: 1025003 | |
| 119 void GetFirefoxInstalledPaths(std::vector<base::FilePath>* out) { | |
| 120 base::win::RegistryKeyIterator it(HKEY_LOCAL_MACHINE, | |
| 121 kRegistryFirefoxInstalled, | |
| 122 KEY_WOW64_32KEY); | |
| 123 for (; it.Valid(); ++it) { | |
| 124 base::string16 full_path = base::string16(kRegistryFirefoxInstalled) + | |
| 125 L"\\" + it.Name() + L"\\Main"; | |
| 126 base::win::RegKey key(HKEY_LOCAL_MACHINE, full_path.c_str(), KEY_READ); | |
| 127 base::string16 install_dir; | |
| 128 if (key.ReadValue(L"Install Directory", &install_dir) != ERROR_SUCCESS) | |
| 129 continue; | |
| 130 out->push_back(base::FilePath(install_dir)); | |
| 131 } | |
| 132 } | |
| 133 | |
| 134 // Get plugin directory locations from the Firefox install path. This is kind | |
| 135 // of a kludge, but it helps us locate the flash player for users that | |
| 136 // already have it for firefox. Not having to download yet-another-plugin | |
| 137 // is a good thing. | |
| 138 void GetFirefoxDirectory(std::set<base::FilePath>* plugin_dirs) { | |
| 139 std::vector<base::FilePath> paths; | |
| 140 GetFirefoxInstalledPaths(&paths); | |
| 141 for (unsigned int i = 0; i < paths.size(); ++i) { | |
| 142 plugin_dirs->insert(AppendPluginsDir(paths[i])); | |
| 143 } | |
| 144 | |
| 145 base::FilePath firefox_app_data_plugin_path; | |
| 146 if (PathService::Get(base::DIR_APP_DATA, &firefox_app_data_plugin_path)) { | |
| 147 firefox_app_data_plugin_path = | |
| 148 firefox_app_data_plugin_path.AppendASCII("Mozilla"); | |
| 149 plugin_dirs->insert(AppendPluginsDir(firefox_app_data_plugin_path)); | |
| 150 } | |
| 151 } | |
| 152 | |
| 153 // Hardcoded logic to detect Acrobat plugins locations. | |
| 154 void GetAcrobatDirectory(std::set<base::FilePath>* plugin_dirs) { | |
| 155 base::FilePath path; | |
| 156 if (!GetInstalledPath(kRegistryAcrobatReader, &path) && | |
| 157 !GetInstalledPath(kRegistryAcrobat, &path)) { | |
| 158 return; | |
| 159 } | |
| 160 | |
| 161 plugin_dirs->insert(path.Append(L"Browser")); | |
| 162 } | |
| 163 | |
| 164 // Hardcoded logic to detect QuickTime plugin location. | |
| 165 void GetQuicktimeDirectory(std::set<base::FilePath>* plugin_dirs) { | |
| 166 base::FilePath path; | |
| 167 if (GetInstalledPath(kRegistryQuickTime, &path)) | |
| 168 plugin_dirs->insert(AppendPluginsDir(path)); | |
| 169 } | |
| 170 | |
| 171 // Hardcoded logic to detect Windows Media Player plugin location. | |
| 172 void GetWindowsMediaDirectory(std::set<base::FilePath>* plugin_dirs) { | |
| 173 base::FilePath path; | |
| 174 if (GetInstalledPath(kRegistryWindowsMedia, &path)) | |
| 175 plugin_dirs->insert(path); | |
| 176 } | |
| 177 | |
| 178 // Hardcoded logic to detect Java plugin location. | |
| 179 void GetJavaDirectory(std::set<base::FilePath>* plugin_dirs) { | |
| 180 // Load the new NPAPI Java plugin | |
| 181 // 1. Open the main JRE key under HKLM | |
| 182 base::win::RegKey java_key(HKEY_LOCAL_MACHINE, kRegistryJava, | |
| 183 KEY_QUERY_VALUE); | |
| 184 | |
| 185 // 2. Read the current Java version | |
| 186 base::string16 java_version; | |
| 187 if (java_key.ReadValue(kRegistryBrowserJavaVersion, &java_version) != | |
| 188 ERROR_SUCCESS) { | |
| 189 java_key.ReadValue(kRegistryCurrentJavaVersion, &java_version); | |
| 190 } | |
| 191 | |
| 192 if (!java_version.empty()) { | |
| 193 java_key.OpenKey(java_version.c_str(), KEY_QUERY_VALUE); | |
| 194 | |
| 195 // 3. Install path of the JRE binaries is specified in "JavaHome" | |
| 196 // value under the Java version key. | |
| 197 base::string16 java_plugin_directory; | |
| 198 if (java_key.ReadValue(kRegistryJavaHome, &java_plugin_directory) == | |
| 199 ERROR_SUCCESS) { | |
| 200 // 4. The new plugin resides under the 'bin/new_plugin' | |
| 201 // subdirectory. | |
| 202 DCHECK(!java_plugin_directory.empty()); | |
| 203 java_plugin_directory.append(L"\\bin\\new_plugin"); | |
| 204 | |
| 205 // 5. We don't know the exact name of the DLL but it's in the form | |
| 206 // NP*.dll so just invoke LoadPlugins on this path. | |
| 207 plugin_dirs->insert(base::FilePath(java_plugin_directory)); | |
| 208 } | |
| 209 } | |
| 210 } | |
| 211 | |
| 212 bool IsValid32BitImage(const base::FilePath& path) { | |
| 213 base::MemoryMappedFile plugin_image; | |
| 214 | |
| 215 if (!plugin_image.InitializeAsImageSection(path)) | |
| 216 return false; | |
| 217 | |
| 218 base::win::PEImage image(plugin_image.data()); | |
| 219 | |
| 220 PIMAGE_NT_HEADERS nt_headers = image.GetNTHeaders(); | |
| 221 return (nt_headers->FileHeader.Machine == IMAGE_FILE_MACHINE_I386); | |
| 222 } | |
| 223 | |
| 224 // Returns true if the given plugins share at least one mime type. This is used | |
| 225 // to differentiate newer versions of a plugin vs two plugins which happen to | |
| 226 // have the same filename. | |
| 227 bool HaveSharedMimeType(const WebPluginInfo& plugin1, | |
| 228 const WebPluginInfo& plugin2) { | |
| 229 for (size_t i = 0; i < plugin1.mime_types.size(); ++i) { | |
| 230 for (size_t j = 0; j < plugin2.mime_types.size(); ++j) { | |
| 231 if (plugin1.mime_types[i].mime_type == plugin2.mime_types[j].mime_type) | |
| 232 return true; | |
| 233 } | |
| 234 } | |
| 235 | |
| 236 return false; | |
| 237 } | |
| 238 | |
| 239 // Compares Windows style version strings (i.e. 1,2,3,4). Returns true if b's | |
| 240 // version is newer than a's, or false if it's equal or older. | |
| 241 bool IsNewerVersion(const base::string16& a, const base::string16& b) { | |
| 242 std::vector<base::string16> a_ver = base::SplitString( | |
| 243 a, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | |
| 244 std::vector<base::string16> b_ver = base::SplitString( | |
| 245 b, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | |
| 246 if (a_ver.size() == 1 && b_ver.size() == 1) { | |
| 247 a_ver = base::SplitString( | |
| 248 a, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | |
| 249 b_ver = base::SplitString( | |
| 250 b, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | |
| 251 } | |
| 252 if (a_ver.size() != b_ver.size()) | |
| 253 return false; | |
| 254 for (size_t i = 0; i < a_ver.size(); i++) { | |
| 255 int cur_a, cur_b; | |
| 256 base::StringToInt(a_ver[i], &cur_a); | |
| 257 base::StringToInt(b_ver[i], &cur_b); | |
| 258 | |
| 259 if (cur_a > cur_b) | |
| 260 return false; | |
| 261 if (cur_a < cur_b) | |
| 262 return true; | |
| 263 } | |
| 264 return false; | |
| 265 } | |
| 266 | |
| 267 } // namespace | |
| 268 | |
| 269 bool PluginList::ReadWebPluginInfo(const base::FilePath& filename, | |
| 270 WebPluginInfo* info) { | |
| 271 // On windows, the way we get the mime types for the library is | |
| 272 // to check the version information in the DLL itself. This | |
| 273 // will be a string of the format: <type1>|<type2>|<type3>|... | |
| 274 // For example: | |
| 275 // video/quicktime|audio/aiff|image/jpeg | |
| 276 scoped_ptr<FileVersionInfo> version_info( | |
| 277 FileVersionInfo::CreateFileVersionInfo(filename)); | |
| 278 if (!version_info) { | |
| 279 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | |
| 280 << "Could not get version info for plugin " | |
| 281 << filename.value(); | |
| 282 return false; | |
| 283 } | |
| 284 | |
| 285 FileVersionInfoWin* version_info_win = | |
| 286 static_cast<FileVersionInfoWin*>(version_info.get()); | |
| 287 | |
| 288 info->name = version_info->product_name(); | |
| 289 info->desc = version_info->file_description(); | |
| 290 info->version = version_info->file_version(); | |
| 291 info->path = filename; | |
| 292 | |
| 293 // TODO(evan): Move the ParseMimeTypes code inline once Pepper is updated. | |
| 294 if (!PluginList::ParseMimeTypes( | |
| 295 base::UTF16ToASCII(version_info_win->GetStringValue(L"MIMEType")), | |
| 296 base::UTF16ToASCII(version_info_win->GetStringValue(L"FileExtents")), | |
| 297 version_info_win->GetStringValue(L"FileOpenName"), | |
| 298 &info->mime_types)) { | |
| 299 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | |
| 300 << "Plugin " << info->name << " has bad MIME types, skipping"; | |
| 301 return false; | |
| 302 } | |
| 303 | |
| 304 return true; | |
| 305 } | |
| 306 | |
| 307 void PluginList::GetPluginDirectories( | |
| 308 std::vector<base::FilePath>* plugin_dirs) { | |
| 309 if (PluginList::plugins_discovery_disabled_) | |
| 310 return; | |
| 311 | |
| 312 // We use a set for uniqueness, which we require, over order, which we do not. | |
| 313 std::set<base::FilePath> dirs; | |
| 314 | |
| 315 // Load from the application-specific area | |
| 316 GetAppDirectory(&dirs); | |
| 317 | |
| 318 // Load from the executable area | |
| 319 GetExeDirectory(&dirs); | |
| 320 | |
| 321 // Load Java | |
| 322 GetJavaDirectory(&dirs); | |
| 323 | |
| 324 // Load firefox plugins too. This is mainly to try to locate | |
| 325 // a pre-installed Flash player. | |
| 326 GetFirefoxDirectory(&dirs); | |
| 327 | |
| 328 // Firefox hard-codes the paths of some popular plugins to ensure that | |
| 329 // the plugins are found. We are going to copy this as well. | |
| 330 GetAcrobatDirectory(&dirs); | |
| 331 GetQuicktimeDirectory(&dirs); | |
| 332 GetWindowsMediaDirectory(&dirs); | |
| 333 | |
| 334 for (std::set<base::FilePath>::iterator i = dirs.begin(); i != dirs.end(); ++i
) | |
| 335 plugin_dirs->push_back(*i); | |
| 336 } | |
| 337 | |
| 338 void PluginList::GetPluginsInDir( | |
| 339 const base::FilePath& path, std::vector<base::FilePath>* plugins) { | |
| 340 WIN32_FIND_DATA find_file_data; | |
| 341 HANDLE find_handle; | |
| 342 | |
| 343 base::string16 dir = path.value(); | |
| 344 // FindFirstFile requires that you specify a wildcard for directories. | |
| 345 dir.append(L"\\NP*.DLL"); | |
| 346 | |
| 347 find_handle = FindFirstFile(dir.c_str(), &find_file_data); | |
| 348 if (find_handle == INVALID_HANDLE_VALUE) | |
| 349 return; | |
| 350 | |
| 351 do { | |
| 352 if (!(find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { | |
| 353 base::FilePath filename = path.Append(find_file_data.cFileName); | |
| 354 plugins->push_back(filename); | |
| 355 } | |
| 356 } while (FindNextFile(find_handle, &find_file_data) != 0); | |
| 357 | |
| 358 DCHECK(GetLastError() == ERROR_NO_MORE_FILES); | |
| 359 FindClose(find_handle); | |
| 360 } | |
| 361 | |
| 362 void PluginList::GetPluginPathsFromRegistry( | |
| 363 std::vector<base::FilePath>* plugins) { | |
| 364 if (PluginList::plugins_discovery_disabled_) | |
| 365 return; | |
| 366 | |
| 367 std::set<base::FilePath> plugin_dirs; | |
| 368 | |
| 369 // Search for plugins from HKCU and HKLM. THis will only find plugins that | |
| 370 // are correctly registered in the correct WOW64 registry hive. | |
| 371 GetPluginsInRegistryDirectory(HKEY_CURRENT_USER, | |
| 372 kRegistryMozillaPlugins, | |
| 373 0, | |
| 374 &plugin_dirs); | |
| 375 GetPluginsInRegistryDirectory(HKEY_LOCAL_MACHINE, | |
| 376 kRegistryMozillaPlugins, | |
| 377 0, | |
| 378 &plugin_dirs); | |
| 379 | |
| 380 for (std::set<base::FilePath>::iterator i = plugin_dirs.begin(); | |
| 381 i != plugin_dirs.end(); ++i) { | |
| 382 plugins->push_back(*i); | |
| 383 } | |
| 384 } | |
| 385 | |
| 386 bool PluginList::ShouldLoadPluginUsingPluginList( | |
| 387 const WebPluginInfo& info, | |
| 388 std::vector<WebPluginInfo>* plugins) { | |
| 389 bool should_check_version = true; | |
| 390 { | |
| 391 base::AutoLock lock(lock_); | |
| 392 should_check_version = | |
| 393 std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), | |
| 394 info.path) == extra_plugin_paths_.end(); | |
| 395 } | |
| 396 // Version check for plugins that are not coming from |extra_plugin_paths_|. | |
| 397 if (should_check_version) { | |
| 398 for (size_t j = 0; j < plugins->size(); ++j) { | |
| 399 base::FilePath::StringType plugin1 = | |
| 400 base::ToLowerASCII((*plugins)[j].path.BaseName().value()); | |
| 401 base::FilePath::StringType plugin2 = | |
| 402 base::ToLowerASCII(info.path.BaseName().value()); | |
| 403 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[j], info)) || | |
| 404 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | |
| 405 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | |
| 406 if (IsNewerVersion(info.version, (*plugins)[j].version)) | |
| 407 return false; // We have loaded a plugin whose version is newer. | |
| 408 plugins->erase(plugins->begin() + j); | |
| 409 break; | |
| 410 } | |
| 411 } | |
| 412 } | |
| 413 | |
| 414 // The checks below only apply to NPAPI plugins. | |
| 415 if (info.type != WebPluginInfo::PLUGIN_TYPE_NPAPI) | |
| 416 return true; | |
| 417 | |
| 418 { | |
| 419 base::AutoLock lock(lock_); | |
| 420 // If the plugin is in our internal list we should load it. | |
| 421 for (size_t i = 0; i < internal_plugins_.size(); ++i) { | |
| 422 if (info.path == internal_plugins_[i].path) | |
| 423 return true; | |
| 424 } | |
| 425 } | |
| 426 | |
| 427 // Troublemakers. | |
| 428 base::FilePath::StringType filename = | |
| 429 base::ToLowerASCII(info.path.BaseName().value()); | |
| 430 // Depends on XPCOM. | |
| 431 if (filename == kMozillaActiveXPlugin) | |
| 432 return false; | |
| 433 | |
| 434 // Disable the Yahoo Application State plugin as it crashes the plugin | |
| 435 // process on return from NPObjectStub::OnInvoke. Please refer to | |
| 436 // http://b/issue?id=1372124 for more information. | |
| 437 if (filename == kYahooApplicationStatePlugin) | |
| 438 return false; | |
| 439 | |
| 440 // Disable the WangWang protocol handler plugin (npww.dll) as it crashes | |
| 441 // chrome during shutdown. Firefox also disables this plugin. | |
| 442 // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953 | |
| 443 // for more information. | |
| 444 if (filename == kWanWangProtocolHandlerPlugin) | |
| 445 return false; | |
| 446 | |
| 447 // We only work with newer versions of the Java plugin which use NPAPI only | |
| 448 // and don't depend on XPCOM. | |
| 449 if (filename == kJavaPlugin1 || filename == kJavaPlugin2) { | |
| 450 std::vector<base::FilePath::StringType> ver = base::SplitString( | |
| 451 info.version, base::FilePath::StringType(1, '.'), | |
| 452 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | |
| 453 int major, minor, update; | |
| 454 if (ver.size() == 4 && | |
| 455 base::StringToInt(ver[0], &major) && | |
| 456 base::StringToInt(ver[1], &minor) && | |
| 457 base::StringToInt(ver[2], &update)) { | |
| 458 if (major == 6 && minor == 0 && update < 120) | |
| 459 return false; // Java SE6 Update 11 or older. | |
| 460 } | |
| 461 } | |
| 462 | |
| 463 // Special WMP handling: | |
| 464 // If both the new and old WMP plugins exist, only load the new one. | |
| 465 if (filename == kNewWMPPlugin) { | |
| 466 for (size_t j = 0; j < plugins->size(); ++j) { | |
| 467 if ((*plugins)[j].path.BaseName().value() == kOldWMPPlugin) { | |
| 468 plugins->erase(plugins->begin() + j); | |
| 469 break; | |
| 470 } | |
| 471 } | |
| 472 | |
| 473 } else if (filename == kOldWMPPlugin) { | |
| 474 for (size_t j = 0; j < plugins->size(); ++j) { | |
| 475 if ((*plugins)[j].path.BaseName().value() == kNewWMPPlugin) | |
| 476 return false; | |
| 477 } | |
| 478 } | |
| 479 | |
| 480 base::FilePath plugin_path(info.path); | |
| 481 #if defined(ARCH_CPU_X86_64) | |
| 482 // The plugin in question could be a 32 bit plugin which we cannot load. | |
| 483 if (IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) | |
| 484 return false; | |
| 485 #else | |
| 486 // The plugin in question could be a 64 bit plugin which we cannot load. | |
| 487 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) | |
| 488 return false; | |
| 489 #endif | |
| 490 return true; | |
| 491 } | |
| 492 | |
| 493 } // namespace content | |
| OLD | NEW |