| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/plugin_list.h" | 5 #include "webkit/glue/plugins/plugin_list.h" |
| 6 | 6 |
| 7 #include <tchar.h> | 7 #include <tchar.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 exe_path = exe_path.AppendASCII("plugins"); | 59 exe_path = exe_path.AppendASCII("plugins"); |
| 60 plugin_dirs->insert(exe_path); | 60 plugin_dirs->insert(exe_path); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Gets the installed path for a registered app. | 63 // Gets the installed path for a registered app. |
| 64 bool GetInstalledPath(const TCHAR* app, FilePath* out) { | 64 bool GetInstalledPath(const TCHAR* app, FilePath* out) { |
| 65 std::wstring reg_path(kRegistryApps); | 65 std::wstring reg_path(kRegistryApps); |
| 66 reg_path.append(L"\\"); | 66 reg_path.append(L"\\"); |
| 67 reg_path.append(app); | 67 reg_path.append(app); |
| 68 | 68 |
| 69 RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str()); | 69 RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); |
| 70 std::wstring path; | 70 std::wstring path; |
| 71 if (key.ReadValue(kRegistryPath, &path)) { | 71 if (key.ReadValue(kRegistryPath, &path)) { |
| 72 *out = FilePath(path); | 72 *out = FilePath(path); |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Search the registry at the given path and detect plugin directories. | 79 // Search the registry at the given path and detect plugin directories. |
| 80 void GetPluginsInRegistryDirectory( | 80 void GetPluginsInRegistryDirectory( |
| 81 HKEY root_key, | 81 HKEY root_key, |
| 82 const std::wstring& registry_folder, | 82 const std::wstring& registry_folder, |
| 83 std::set<FilePath>* plugin_dirs) { | 83 std::set<FilePath>* plugin_dirs) { |
| 84 for (RegistryKeyIterator iter(root_key, registry_folder.c_str()); | 84 for (RegistryKeyIterator iter(root_key, registry_folder.c_str()); |
| 85 iter.Valid(); ++iter) { | 85 iter.Valid(); ++iter) { |
| 86 // Use the registry to gather plugin across the file system. | 86 // Use the registry to gather plugin across the file system. |
| 87 std::wstring reg_path = registry_folder; | 87 std::wstring reg_path = registry_folder; |
| 88 reg_path.append(L"\\"); | 88 reg_path.append(L"\\"); |
| 89 reg_path.append(iter.Name()); | 89 reg_path.append(iter.Name()); |
| 90 RegKey key(root_key, reg_path.c_str()); | 90 RegKey key(root_key, reg_path.c_str(), KEY_READ); |
| 91 | 91 |
| 92 std::wstring path; | 92 std::wstring path; |
| 93 if (key.ReadValue(kRegistryPath, &path)) | 93 if (key.ReadValue(kRegistryPath, &path)) |
| 94 plugin_dirs->insert(FilePath(path)); | 94 plugin_dirs->insert(FilePath(path)); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Enumerate through the registry key to find all installed FireFox paths. | 98 // Enumerate through the registry key to find all installed FireFox paths. |
| 99 // FireFox 3 beta and version 2 can coexist. See bug: 1025003 | 99 // FireFox 3 beta and version 2 can coexist. See bug: 1025003 |
| 100 void GetFirefoxInstalledPaths(std::vector<FilePath>* out) { | 100 void GetFirefoxInstalledPaths(std::vector<FilePath>* out) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 for (size_t i = 0; i < plugins->size(); ++i) { | 398 for (size_t i = 0; i < plugins->size(); ++i) { |
| 399 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) | 399 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) |
| 400 return false; | 400 return false; |
| 401 } | 401 } |
| 402 } | 402 } |
| 403 | 403 |
| 404 return true; | 404 return true; |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace NPAPI | 407 } // namespace NPAPI |
| OLD | NEW |