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

Side by Side Diff: webkit/plugins/npapi/plugin_list_win.cc

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/npapi/plugin_list_posix.cc ('k') | webkit/plugins/npapi/plugin_stream.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) 2010 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/plugins/npapi/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"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/scoped_ptr.h" 15 #include "base/scoped_ptr.h"
16 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
17 #include "base/string_split.h" 17 #include "base/string_split.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/win/registry.h" 19 #include "base/win/registry.h"
20 #include "webkit/glue/plugins/plugin_constants_win.h" 20 #include "webkit/plugins/npapi/plugin_constants_win.h"
21 #include "webkit/glue/plugins/plugin_lib.h" 21 #include "webkit/plugins/npapi/plugin_lib.h"
22 #include "webkit/plugins/plugin_switches.h"
22 #include "webkit/glue/webkit_glue.h" 23 #include "webkit/glue/webkit_glue.h"
23 24
25 namespace webkit {
26 namespace npapi {
27
24 namespace { 28 namespace {
25 29
26 const TCHAR kRegistryApps[] = 30 const char16 kRegistryApps[] =
27 _T("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"); 31 L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths";
28 const TCHAR kRegistryFirefox[] = _T("firefox.exe"); 32 const char16 kRegistryFirefox[] = L"firefox.exe";
29 const TCHAR kRegistryAcrobat[] = _T("Acrobat.exe"); 33 const char16 kRegistryAcrobat[] = L"Acrobat.exe";
30 const TCHAR kRegistryAcrobatReader[] = _T("AcroRd32.exe"); 34 const char16 kRegistryAcrobatReader[] = L"AcroRd32.exe";
31 const TCHAR kRegistryWindowsMedia[] = _T("wmplayer.exe"); 35 const char16 kRegistryWindowsMedia[] = L"wmplayer.exe";
32 const TCHAR kRegistryQuickTime[] = _T("QuickTimePlayer.exe"); 36 const char16 kRegistryQuickTime[] = L"QuickTimePlayer.exe";
33 const TCHAR kRegistryPath[] = _T("Path"); 37 const char16 kRegistryPath[] = L"Path";
34 const TCHAR kRegistryFirefoxInstalled[] = 38 const char16 kRegistryFirefoxInstalled[] =
35 _T("SOFTWARE\\Mozilla\\Mozilla Firefox"); 39 L"SOFTWARE\\Mozilla\\Mozilla Firefox";
36 const TCHAR kRegistryJava[] = 40 const char16 kRegistryJava[] =
37 _T("Software\\JavaSoft\\Java Runtime Environment"); 41 L"Software\\JavaSoft\\Java Runtime Environment";
38 const TCHAR kRegistryBrowserJavaVersion[] = _T("BrowserJavaVersion"); 42 const char16 kRegistryBrowserJavaVersion[] = L"BrowserJavaVersion";
39 const TCHAR kRegistryCurrentJavaVersion[] = _T("CurrentVersion"); 43 const char16 kRegistryCurrentJavaVersion[] = L"CurrentVersion";
40 const TCHAR kRegistryJavaHome[] = _T("JavaHome"); 44 const char16 kRegistryJavaHome[] = L"JavaHome";
41 const TCHAR kJavaDeploy1[] = _T("npdeploytk.dll"); 45 const char16 kJavaDeploy1[] = L"npdeploytk.dll";
42 const TCHAR kJavaDeploy2[] = _T("npdeployjava1.dll"); 46 const char16 kJavaDeploy2[] = L"npdeployjava1.dll";
43 47
44 // The application path where we expect to find plugins. 48 // The application path where we expect to find plugins.
45 void GetAppDirectory(std::set<FilePath>* plugin_dirs) { 49 void GetAppDirectory(std::set<FilePath>* plugin_dirs) {
46 FilePath app_path; 50 FilePath app_path;
47 if (!webkit_glue::GetApplicationDirectory(&app_path)) 51 if (!webkit_glue::GetApplicationDirectory(&app_path))
48 return; 52 return;
49 53
50 app_path = app_path.AppendASCII("plugins"); 54 app_path = app_path.AppendASCII("plugins");
51 plugin_dirs->insert(app_path); 55 plugin_dirs->insert(app_path);
52 } 56 }
53 57
54 // The executable path where we expect to find plugins. 58 // The executable path where we expect to find plugins.
55 void GetExeDirectory(std::set<FilePath>* plugin_dirs) { 59 void GetExeDirectory(std::set<FilePath>* plugin_dirs) {
56 FilePath exe_path; 60 FilePath exe_path;
57 if (!webkit_glue::GetExeDirectory(&exe_path)) 61 if (!webkit_glue::GetExeDirectory(&exe_path))
58 return; 62 return;
59 63
60 exe_path = exe_path.AppendASCII("plugins"); 64 exe_path = exe_path.AppendASCII("plugins");
61 plugin_dirs->insert(exe_path); 65 plugin_dirs->insert(exe_path);
62 } 66 }
63 67
64 // Gets the installed path for a registered app. 68 // Gets the installed path for a registered app.
65 bool GetInstalledPath(const TCHAR* app, FilePath* out) { 69 bool GetInstalledPath(const char16* app, FilePath* out) {
66 std::wstring reg_path(kRegistryApps); 70 std::wstring reg_path(kRegistryApps);
67 reg_path.append(L"\\"); 71 reg_path.append(L"\\");
68 reg_path.append(app); 72 reg_path.append(app);
69 73
70 base::win::RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); 74 base::win::RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ);
71 std::wstring path; 75 std::wstring path;
72 if (key.ReadValue(kRegistryPath, &path)) { 76 if (key.ReadValue(kRegistryPath, &path)) {
73 *out = FilePath(path); 77 *out = FilePath(path);
74 return true; 78 return true;
75 } 79 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 207
204 // 5. We don't know the exact name of the DLL but it's in the form 208 // 5. We don't know the exact name of the DLL but it's in the form
205 // NP*.dll so just invoke LoadPlugins on this path. 209 // NP*.dll so just invoke LoadPlugins on this path.
206 plugin_dirs->insert(FilePath(java_plugin_directory)); 210 plugin_dirs->insert(FilePath(java_plugin_directory));
207 } 211 }
208 } 212 }
209 } 213 }
210 214
211 } // anonymous namespace 215 } // anonymous namespace
212 216
213 namespace NPAPI {
214
215 void PluginList::PlatformInit() { 217 void PluginList::PlatformInit() {
216 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 218 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
217 dont_load_new_wmp_ = command_line.HasSwitch(kUseOldWMPPluginSwitch); 219 dont_load_new_wmp_ = command_line.HasSwitch(switches::kUseOldWMPPlugin);
218 } 220 }
219 221
220 void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { 222 void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) {
221 // We use a set for uniqueness, which we require, over order, which we do not. 223 // We use a set for uniqueness, which we require, over order, which we do not.
222 std::set<FilePath> dirs; 224 std::set<FilePath> dirs;
223 225
224 // Load from the application-specific area 226 // Load from the application-specific area
225 GetAppDirectory(&dirs); 227 GetAppDirectory(&dirs);
226 228
227 // Load from the executable area 229 // Load from the executable area
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } else if (filename == kOldWMPPlugin) { 402 } else if (filename == kOldWMPPlugin) {
401 for (size_t i = 0; i < plugins->size(); ++i) { 403 for (size_t i = 0; i < plugins->size(); ++i) {
402 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) 404 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin)
403 return false; 405 return false;
404 } 406 }
405 } 407 }
406 408
407 return true; 409 return true;
408 } 410 }
409 411
410 } // namespace NPAPI 412 } // namespace npapi
413 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_list_posix.cc ('k') | webkit/plugins/npapi/plugin_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698