OLD | NEW |
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 "webkit/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 version_info_win->GetStringValue(L"FileOpenName"), | 298 version_info_win->GetStringValue(L"FileOpenName"), |
299 &info->mime_types)) { | 299 &info->mime_types)) { |
300 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 300 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
301 << "Plugin " << info->name << " has bad MIME types, skipping"; | 301 << "Plugin " << info->name << " has bad MIME types, skipping"; |
302 return false; | 302 return false; |
303 } | 303 } |
304 | 304 |
305 return true; | 305 return true; |
306 } | 306 } |
307 | 307 |
308 void PluginList::GetPluginDirectories(std::vector<base::FilePath>* plugin_dirs)
{ | 308 void PluginList::GetPluginDirectories( |
| 309 std::vector<base::FilePath>* plugin_dirs) { |
| 310 if (PluginList::plugins_discovery_disabled_) |
| 311 return; |
| 312 |
309 // We use a set for uniqueness, which we require, over order, which we do not. | 313 // We use a set for uniqueness, which we require, over order, which we do not. |
310 std::set<base::FilePath> dirs; | 314 std::set<base::FilePath> dirs; |
311 | 315 |
312 // Load from the application-specific area | 316 // Load from the application-specific area |
313 GetAppDirectory(&dirs); | 317 GetAppDirectory(&dirs); |
314 | 318 |
315 // Load from the executable area | 319 // Load from the executable area |
316 GetExeDirectory(&dirs); | 320 GetExeDirectory(&dirs); |
317 | 321 |
318 // Load Java | 322 // Load Java |
(...skipping 30 matching lines...) Expand all Loading... |
349 if (!(find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { | 353 if (!(find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { |
350 base::FilePath filename = path.Append(find_file_data.cFileName); | 354 base::FilePath filename = path.Append(find_file_data.cFileName); |
351 plugins->push_back(filename); | 355 plugins->push_back(filename); |
352 } | 356 } |
353 } while (FindNextFile(find_handle, &find_file_data) != 0); | 357 } while (FindNextFile(find_handle, &find_file_data) != 0); |
354 | 358 |
355 DCHECK(GetLastError() == ERROR_NO_MORE_FILES); | 359 DCHECK(GetLastError() == ERROR_NO_MORE_FILES); |
356 FindClose(find_handle); | 360 FindClose(find_handle); |
357 } | 361 } |
358 | 362 |
359 void PluginList::GetPluginPathsFromRegistry(std::vector<base::FilePath>* plugins
) { | 363 void PluginList::GetPluginPathsFromRegistry( |
| 364 std::vector<base::FilePath>* plugins) { |
| 365 if (PluginList::plugins_discovery_disabled_) |
| 366 return; |
| 367 |
360 std::set<base::FilePath> plugin_dirs; | 368 std::set<base::FilePath> plugin_dirs; |
361 | 369 |
362 GetPluginsInRegistryDirectory( | 370 GetPluginsInRegistryDirectory( |
363 HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs); | 371 HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs); |
364 GetPluginsInRegistryDirectory( | 372 GetPluginsInRegistryDirectory( |
365 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs); | 373 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs); |
366 | 374 |
367 for (std::set<base::FilePath>::iterator i = plugin_dirs.begin(); | 375 for (std::set<base::FilePath>::iterator i = plugin_dirs.begin(); |
368 i != plugin_dirs.end(); ++i) { | 376 i != plugin_dirs.end(); ++i) { |
369 plugins->push_back(*i); | 377 plugins->push_back(*i); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // The plugin in question could be a 64 bit plugin which we cannot load. | 466 // The plugin in question could be a 64 bit plugin which we cannot load. |
459 base::FilePath plugin_path(info.path); | 467 base::FilePath plugin_path(info.path); |
460 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) | 468 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
461 return false; | 469 return false; |
462 #endif | 470 #endif |
463 return true; | 471 return true; |
464 } | 472 } |
465 | 473 |
466 } // namespace npapi | 474 } // namespace npapi |
467 } // namespace webkit | 475 } // namespace webkit |
OLD | NEW |