Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <tchar.h> | 5 #include <tchar.h> |
| 6 | 6 |
| 7 #include "webkit/glue/plugins/plugin_list.h" | 7 #include "webkit/glue/plugins/plugin_list.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "base/registry.h" | 13 #include "base/registry.h" |
| 14 #include "base/scoped_ptr.h" | |
| 13 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 14 #include "webkit/glue/plugins/plugin_constants_win.h" | 16 #include "webkit/glue/plugins/plugin_constants_win.h" |
| 15 #include "webkit/glue/plugins/plugin_lib.h" | 17 #include "webkit/glue/plugins/plugin_lib.h" |
| 16 #include "webkit/glue/webkit_glue.h" | 18 #include "webkit/glue/webkit_glue.h" |
| 17 | 19 |
| 18 namespace { | 20 namespace { |
| 19 | 21 |
| 20 const TCHAR kRegistryApps[] = | 22 const TCHAR kRegistryApps[] = |
| 21 _T("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"); | 23 _T("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"); |
| 22 const TCHAR kRegistryFirefox[] = _T("firefox.exe"); | 24 const TCHAR kRegistryFirefox[] = _T("firefox.exe"); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 FilePath path; | 144 FilePath path; |
| 143 if (GetInstalledPath(kRegistryQuickTime, &path)) | 145 if (GetInstalledPath(kRegistryQuickTime, &path)) |
| 144 plugin_dirs->insert(path.Append(L"plugins")); | 146 plugin_dirs->insert(path.Append(L"plugins")); |
| 145 } | 147 } |
| 146 | 148 |
| 147 // Hardcoded logic to detect Windows Media Player plugin location. | 149 // Hardcoded logic to detect Windows Media Player plugin location. |
| 148 void GetWindowsMediaDirectory(std::set<FilePath>* plugin_dirs) { | 150 void GetWindowsMediaDirectory(std::set<FilePath>* plugin_dirs) { |
| 149 FilePath path; | 151 FilePath path; |
| 150 if (GetInstalledPath(kRegistryWindowsMedia, &path)) | 152 if (GetInstalledPath(kRegistryWindowsMedia, &path)) |
| 151 plugin_dirs->insert(path); | 153 plugin_dirs->insert(path); |
| 154 | |
| 155 // If the Windows Media Player Firefox plugin is installed before Firefox, | |
| 156 // the plugin will get written under PFiles\Plugins on one the drives | |
| 157 // (usually, but not always, the last letter). | |
| 158 int size = GetLogicalDriveStrings(0, NULL); | |
| 159 if (size) { | |
| 160 scoped_array<wchar_t> strings(new wchar_t[size]); | |
| 161 if (GetLogicalDriveStrings(size, strings.get())) { | |
| 162 wchar_t *next_drive = strings.get(); | |
|
ananta
2009/09/18 17:43:57
wchar_t* ?
| |
| 163 while (*next_drive) { | |
| 164 if (GetDriveType(next_drive) == DRIVE_FIXED) { | |
| 165 FilePath pfiles(next_drive); | |
| 166 pfiles = pfiles.Append(L"PFiles\\Plugins"); | |
| 167 if (file_util::PathExists(pfiles)) | |
| 168 plugin_dirs->insert(pfiles); | |
| 169 } | |
| 170 next_drive = &next_drive[wcslen(next_drive) + 1]; | |
| 171 } | |
| 172 } | |
| 173 } | |
| 152 } | 174 } |
| 153 | 175 |
| 154 // Hardcoded logic to detect Java plugin location. | 176 // Hardcoded logic to detect Java plugin location. |
| 155 void GetJavaDirectory(std::set<FilePath>* plugin_dirs) { | 177 void GetJavaDirectory(std::set<FilePath>* plugin_dirs) { |
| 156 // Load the new NPAPI Java plugin | 178 // Load the new NPAPI Java plugin |
| 157 // 1. Open the main JRE key under HKLM | 179 // 1. Open the main JRE key under HKLM |
| 158 RegKey java_key(HKEY_LOCAL_MACHINE, kRegistryJava, KEY_QUERY_VALUE); | 180 RegKey java_key(HKEY_LOCAL_MACHINE, kRegistryJava, KEY_QUERY_VALUE); |
| 159 | 181 |
| 160 // 2. Read the current Java version | 182 // 2. Read the current Java version |
| 161 std::wstring java_version; | 183 std::wstring java_version; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 for (size_t i = 0; i < plugins->size(); ++i) { | 332 for (size_t i = 0; i < plugins->size(); ++i) { |
| 311 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) | 333 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) |
| 312 return false; | 334 return false; |
| 313 } | 335 } |
| 314 } | 336 } |
| 315 | 337 |
| 316 return true; | 338 return true; |
| 317 } | 339 } |
| 318 | 340 |
| 319 } // namespace NPAPI | 341 } // namespace NPAPI |
| OLD | NEW |