OLD | NEW |
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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/plugin_service.h" | 7 #include "chrome/browser/plugin_service.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/common/default_plugin.h" | 27 #include "chrome/common/default_plugin.h" |
28 #include "chrome/common/extensions/extension.h" | 28 #include "chrome/common/extensions/extension.h" |
29 #include "chrome/common/gpu_plugin.h" | 29 #include "chrome/common/gpu_plugin.h" |
30 #include "chrome/common/logging_chrome.h" | 30 #include "chrome/common/logging_chrome.h" |
31 #include "chrome/common/notification_type.h" | 31 #include "chrome/common/notification_type.h" |
32 #include "chrome/common/notification_service.h" | 32 #include "chrome/common/notification_service.h" |
33 #include "chrome/common/pepper_plugin_registry.h" | 33 #include "chrome/common/pepper_plugin_registry.h" |
34 #include "chrome/common/plugin_messages.h" | 34 #include "chrome/common/plugin_messages.h" |
35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
36 #include "chrome/common/render_messages.h" | 36 #include "chrome/common/render_messages.h" |
| 37 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| 38 #include "webkit/plugins/npapi/plugin_list.h" |
| 39 #include "webkit/plugins/npapi/webplugininfo.h" |
| 40 |
37 #ifndef DISABLE_NACL | 41 #ifndef DISABLE_NACL |
38 #include "native_client/src/trusted/plugin/nacl_entry_points.h" | 42 #include "native_client/src/trusted/plugin/nacl_entry_points.h" |
39 #endif | 43 #endif |
40 #include "webkit/glue/plugins/plugin_constants_win.h" | |
41 #include "webkit/glue/plugins/plugin_list.h" | |
42 #include "webkit/glue/plugins/webplugininfo.h" | |
43 | 44 |
44 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
45 #include "chrome/browser/chromeos/plugin_selection_policy.h" | 46 #include "chrome/browser/chromeos/plugin_selection_policy.h" |
46 #endif | 47 #endif |
47 | 48 |
48 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
49 static void NotifyPluginsOfActivation() { | 50 static void NotifyPluginsOfActivation() { |
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
51 | 52 |
52 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); | 53 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); |
53 !iter.Done(); ++iter) { | 54 !iter.Done(); ++iter) { |
54 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); | 55 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); |
55 plugin->OnAppActivation(); | 56 plugin->OnAppActivation(); |
56 } | 57 } |
57 } | 58 } |
58 #endif | 59 #endif |
59 | 60 |
60 // static | 61 // static |
61 bool PluginService::enable_chrome_plugins_ = true; | 62 bool PluginService::enable_chrome_plugins_ = true; |
62 | 63 |
63 // static | 64 // static |
64 void PluginService::InitGlobalInstance(Profile* profile) { | 65 void PluginService::InitGlobalInstance(Profile* profile) { |
65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
66 | 67 |
67 // We first group the plugins and then figure out which groups to disable. | 68 // We first group the plugins and then figure out which groups to disable. |
68 PluginUpdater::GetInstance()->DisablePluginGroupsFromPrefs(profile); | 69 PluginUpdater::GetInstance()->DisablePluginGroupsFromPrefs(profile); |
69 | 70 |
70 if (CommandLine::ForCurrentProcess()->HasSwitch( | 71 if (CommandLine::ForCurrentProcess()->HasSwitch( |
71 switches::kDisableOutdatedPlugins)) { | 72 switches::kDisableOutdatedPlugins)) { |
72 NPAPI::PluginList::Singleton()->DisableOutdatedPluginGroups(); | 73 webkit::npapi::PluginList::Singleton()->DisableOutdatedPluginGroups(); |
73 } | 74 } |
74 | 75 |
75 // Have Chrome plugins write their data to the profile directory. | 76 // Have Chrome plugins write their data to the profile directory. |
76 GetInstance()->SetChromePluginDataDir(profile->GetPath()); | 77 GetInstance()->SetChromePluginDataDir(profile->GetPath()); |
77 } | 78 } |
78 | 79 |
79 // static | 80 // static |
80 PluginService* PluginService::GetInstance() { | 81 PluginService* PluginService::GetInstance() { |
81 return Singleton<PluginService>::get(); | 82 return Singleton<PluginService>::get(); |
82 } | 83 } |
83 | 84 |
84 // static | 85 // static |
85 void PluginService::EnableChromePlugins(bool enable) { | 86 void PluginService::EnableChromePlugins(bool enable) { |
86 enable_chrome_plugins_ = enable; | 87 enable_chrome_plugins_ = enable; |
87 } | 88 } |
88 | 89 |
89 PluginService::PluginService() | 90 PluginService::PluginService() |
90 : main_message_loop_(MessageLoop::current()), | 91 : main_message_loop_(MessageLoop::current()), |
91 resource_dispatcher_host_(NULL), | 92 resource_dispatcher_host_(NULL), |
92 ui_locale_(g_browser_process->GetApplicationLocale()) { | 93 ui_locale_(g_browser_process->GetApplicationLocale()) { |
93 RegisterPepperPlugins(); | 94 RegisterPepperPlugins(); |
94 | 95 |
95 // Have the NPAPI plugin list search for Chrome plugins as well. | 96 // Have the NPAPI plugin list search for Chrome plugins as well. |
96 ChromePluginLib::RegisterPluginsWithNPAPI(); | 97 ChromePluginLib::RegisterPluginsWithNPAPI(); |
97 | 98 |
98 // Load any specified on the command line as well. | 99 // Load any specified on the command line as well. |
99 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 100 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
100 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); | 101 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); |
101 if (!path.empty()) | 102 if (!path.empty()) |
102 NPAPI::PluginList::Singleton()->AddExtraPluginPath(path); | 103 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); |
103 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); | 104 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); |
104 if (!path.empty()) | 105 if (!path.empty()) |
105 NPAPI::PluginList::Singleton()->AddExtraPluginDir(path); | 106 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(path); |
106 | 107 |
107 chrome::RegisterInternalDefaultPlugin(); | 108 chrome::RegisterInternalDefaultPlugin(); |
108 | 109 |
109 // Register the internal Flash and PDF, if available. | 110 // Register the internal Flash and PDF, if available. |
110 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 111 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
111 switches::kDisableInternalFlash) && | 112 switches::kDisableInternalFlash) && |
112 PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) { | 113 PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) { |
113 NPAPI::PluginList::Singleton()->AddExtraPluginPath(path); | 114 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); |
114 } | 115 } |
115 | 116 |
116 #ifndef DISABLE_NACL | 117 #ifndef DISABLE_NACL |
117 if (command_line->HasSwitch(switches::kInternalNaCl)) { | 118 if (command_line->HasSwitch(switches::kInternalNaCl)) { |
118 RegisterInternalNaClPlugin(); | 119 RegisterInternalNaClPlugin(); |
119 } | 120 } |
120 #endif | 121 #endif |
121 | 122 |
122 #if defined(OS_CHROMEOS) | 123 #if defined(OS_CHROMEOS) |
123 plugin_selection_policy_ = new chromeos::PluginSelectionPolicy; | 124 plugin_selection_policy_ = new chromeos::PluginSelectionPolicy; |
(...skipping 14 matching lines...) Expand all Loading... |
138 | 139 |
139 if (hklm_key_.StartWatching()) { | 140 if (hklm_key_.StartWatching()) { |
140 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); | 141 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); |
141 hklm_watcher_.StartWatching(hklm_event_.get(), this); | 142 hklm_watcher_.StartWatching(hklm_event_.get(), this); |
142 } | 143 } |
143 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 144 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
144 // Also find plugins in a user-specific plugins dir, | 145 // Also find plugins in a user-specific plugins dir, |
145 // e.g. ~/.config/chromium/Plugins. | 146 // e.g. ~/.config/chromium/Plugins. |
146 FilePath user_data_dir; | 147 FilePath user_data_dir; |
147 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | 148 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
148 NPAPI::PluginList::Singleton()->AddExtraPluginDir( | 149 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir( |
149 user_data_dir.Append("Plugins")); | 150 user_data_dir.Append("Plugins")); |
150 } | 151 } |
151 #endif | 152 #endif |
152 | 153 |
153 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 154 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
154 NotificationService::AllSources()); | 155 NotificationService::AllSources()); |
155 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 156 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
156 NotificationService::AllSources()); | 157 NotificationService::AllSources()); |
157 #if defined(OS_MACOSX) | 158 #if defined(OS_MACOSX) |
158 // We need to know when the browser comes forward so we can bring modal plugin | 159 // We need to know when the browser comes forward so we can bring modal plugin |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 211 } |
211 | 212 |
212 PluginProcessHost* PluginService::FindOrStartPluginProcess( | 213 PluginProcessHost* PluginService::FindOrStartPluginProcess( |
213 const FilePath& plugin_path) { | 214 const FilePath& plugin_path) { |
214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
215 | 216 |
216 PluginProcessHost* plugin_host = FindPluginProcess(plugin_path); | 217 PluginProcessHost* plugin_host = FindPluginProcess(plugin_path); |
217 if (plugin_host) | 218 if (plugin_host) |
218 return plugin_host; | 219 return plugin_host; |
219 | 220 |
220 WebPluginInfo info; | 221 webkit::npapi::WebPluginInfo info; |
221 if (!NPAPI::PluginList::Singleton()->GetPluginInfoByPath( | 222 if (!webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath( |
222 plugin_path, &info)) { | 223 plugin_path, &info)) { |
223 return NULL; | 224 return NULL; |
224 } | 225 } |
225 | 226 |
226 // This plugin isn't loaded by any plugin process, so create a new process. | 227 // This plugin isn't loaded by any plugin process, so create a new process. |
227 scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost()); | 228 scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost()); |
228 if (!new_host->Init(info, ui_locale_)) { | 229 if (!new_host->Init(info, ui_locale_)) { |
229 NOTREACHED(); // Init is not expected to fail | 230 NOTREACHED(); // Init is not expected to fail |
230 return NULL; | 231 return NULL; |
231 } | 232 } |
232 | 233 |
(...skipping 11 matching lines...) Expand all Loading... |
244 NewRunnableMethod( | 245 NewRunnableMethod( |
245 this, &PluginService::GetAllowedPluginForOpenChannelToPlugin, | 246 this, &PluginService::GetAllowedPluginForOpenChannelToPlugin, |
246 url, mime_type, client)); | 247 url, mime_type, client)); |
247 } | 248 } |
248 | 249 |
249 void PluginService::GetAllowedPluginForOpenChannelToPlugin( | 250 void PluginService::GetAllowedPluginForOpenChannelToPlugin( |
250 const GURL& url, | 251 const GURL& url, |
251 const std::string& mime_type, | 252 const std::string& mime_type, |
252 PluginProcessHost::Client* client) { | 253 PluginProcessHost::Client* client) { |
253 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
254 WebPluginInfo info; | 255 webkit::npapi::WebPluginInfo info; |
255 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); | 256 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); |
256 FilePath plugin_path; | 257 FilePath plugin_path; |
257 if (found && info.enabled) | 258 if (found && info.enabled) |
258 plugin_path = FilePath(info.path); | 259 plugin_path = FilePath(info.path); |
259 | 260 |
260 // Now we jump back to the IO thread to finish opening the channel. | 261 // Now we jump back to the IO thread to finish opening the channel. |
261 BrowserThread::PostTask( | 262 BrowserThread::PostTask( |
262 BrowserThread::IO, FROM_HERE, | 263 BrowserThread::IO, FROM_HERE, |
263 NewRunnableMethod( | 264 NewRunnableMethod( |
264 this, &PluginService::FinishOpenChannelToPlugin, | 265 this, &PluginService::FinishOpenChannelToPlugin, |
265 plugin_path, client)); | 266 plugin_path, client)); |
266 } | 267 } |
267 | 268 |
268 void PluginService::FinishOpenChannelToPlugin( | 269 void PluginService::FinishOpenChannelToPlugin( |
269 const FilePath& plugin_path, | 270 const FilePath& plugin_path, |
270 PluginProcessHost::Client* client) { | 271 PluginProcessHost::Client* client) { |
271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
272 | 273 |
273 PluginProcessHost* plugin_host = FindOrStartPluginProcess(plugin_path); | 274 PluginProcessHost* plugin_host = FindOrStartPluginProcess(plugin_path); |
274 if (plugin_host) | 275 if (plugin_host) |
275 plugin_host->OpenChannelToPlugin(client); | 276 plugin_host->OpenChannelToPlugin(client); |
276 else | 277 else |
277 client->OnError(); | 278 client->OnError(); |
278 } | 279 } |
279 | 280 |
280 bool PluginService::GetFirstAllowedPluginInfo( | 281 bool PluginService::GetFirstAllowedPluginInfo( |
281 const GURL& url, | 282 const GURL& url, |
282 const std::string& mime_type, | 283 const std::string& mime_type, |
283 WebPluginInfo* info, | 284 webkit::npapi::WebPluginInfo* info, |
284 std::string* actual_mime_type) { | 285 std::string* actual_mime_type) { |
285 // GetPluginInfoArray may need to load the plugins, so we need to be | 286 // GetPluginInfoArray may need to load the plugins, so we need to be |
286 // on the FILE thread. | 287 // on the FILE thread. |
287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
288 bool allow_wildcard = true; | 289 bool allow_wildcard = true; |
289 #if defined(OS_CHROMEOS) | 290 #if defined(OS_CHROMEOS) |
290 std::vector<WebPluginInfo> info_array; | 291 std::vector<webkit::npapi::WebPluginInfo> info_array; |
291 std::vector<std::string> actual_mime_types; | 292 std::vector<std::string> actual_mime_types; |
292 NPAPI::PluginList::Singleton()->GetPluginInfoArray( | 293 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( |
293 url, mime_type, allow_wildcard, &info_array, &actual_mime_types); | 294 url, mime_type, allow_wildcard, &info_array, &actual_mime_types); |
294 | 295 |
295 // Now we filter by the plugin selection policy. | 296 // Now we filter by the plugin selection policy. |
296 int allowed_index = plugin_selection_policy_->FindFirstAllowed(url, | 297 int allowed_index = plugin_selection_policy_->FindFirstAllowed(url, |
297 info_array); | 298 info_array); |
298 if (!info_array.empty() && allowed_index >= 0) { | 299 if (!info_array.empty() && allowed_index >= 0) { |
299 *info = info_array[allowed_index]; | 300 *info = info_array[allowed_index]; |
300 if (actual_mime_type) | 301 if (actual_mime_type) |
301 *actual_mime_type = actual_mime_types[allowed_index]; | 302 *actual_mime_type = actual_mime_types[allowed_index]; |
302 return true; | 303 return true; |
303 } | 304 } |
304 return false; | 305 return false; |
305 #else | 306 #else |
306 return NPAPI::PluginList::Singleton()->GetPluginInfo( | 307 return webkit::npapi::PluginList::Singleton()->GetPluginInfo( |
307 url, mime_type, allow_wildcard, info, actual_mime_type); | 308 url, mime_type, allow_wildcard, info, actual_mime_type); |
308 #endif | 309 #endif |
309 } | 310 } |
310 | 311 |
311 static void PurgePluginListCache(bool reload_pages) { | 312 static void PurgePluginListCache(bool reload_pages) { |
312 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); | 313 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); |
313 !it.IsAtEnd(); it.Advance()) { | 314 !it.IsAtEnd(); it.Advance()) { |
314 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); | 315 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); |
315 } | 316 } |
316 } | 317 } |
317 | 318 |
318 void PluginService::OnWaitableEventSignaled( | 319 void PluginService::OnWaitableEventSignaled( |
319 base::WaitableEvent* waitable_event) { | 320 base::WaitableEvent* waitable_event) { |
320 #if defined(OS_WIN) | 321 #if defined(OS_WIN) |
321 if (waitable_event == hkcu_event_.get()) { | 322 if (waitable_event == hkcu_event_.get()) { |
322 hkcu_key_.StartWatching(); | 323 hkcu_key_.StartWatching(); |
323 } else { | 324 } else { |
324 hklm_key_.StartWatching(); | 325 hklm_key_.StartWatching(); |
325 } | 326 } |
326 | 327 |
327 NPAPI::PluginList::Singleton()->RefreshPlugins(); | 328 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
328 PurgePluginListCache(true); | 329 PurgePluginListCache(true); |
329 #endif // defined(OS_WIN) | 330 #endif // defined(OS_WIN) |
330 } | 331 } |
331 | 332 |
332 static void ForceShutdownPlugin(const FilePath& plugin_path) { | 333 static void ForceShutdownPlugin(const FilePath& plugin_path) { |
333 PluginProcessHost* plugin = | 334 PluginProcessHost* plugin = |
334 PluginService::GetInstance()->FindPluginProcess(plugin_path); | 335 PluginService::GetInstance()->FindPluginProcess(plugin_path); |
335 if (plugin) | 336 if (plugin) |
336 plugin->ForceShutdown(); | 337 plugin->ForceShutdown(); |
337 } | 338 } |
338 | 339 |
339 void PluginService::Observe(NotificationType type, | 340 void PluginService::Observe(NotificationType type, |
340 const NotificationSource& source, | 341 const NotificationSource& source, |
341 const NotificationDetails& details) { | 342 const NotificationDetails& details) { |
342 switch (type.value) { | 343 switch (type.value) { |
343 case NotificationType::EXTENSION_LOADED: { | 344 case NotificationType::EXTENSION_LOADED: { |
344 const Extension* extension = Details<const Extension>(details).ptr(); | 345 const Extension* extension = Details<const Extension>(details).ptr(); |
345 bool plugins_changed = false; | 346 bool plugins_changed = false; |
346 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 347 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
347 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 348 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
348 NPAPI::PluginList::Singleton()->RefreshPlugins(); | 349 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
349 NPAPI::PluginList::Singleton()->AddExtraPluginPath(plugin.path); | 350 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); |
350 plugins_changed = true; | 351 plugins_changed = true; |
351 if (!plugin.is_public) | 352 if (!plugin.is_public) |
352 private_plugins_[plugin.path] = extension->url(); | 353 private_plugins_[plugin.path] = extension->url(); |
353 } | 354 } |
354 if (plugins_changed) | 355 if (plugins_changed) |
355 PurgePluginListCache(false); | 356 PurgePluginListCache(false); |
356 break; | 357 break; |
357 } | 358 } |
358 | 359 |
359 case NotificationType::EXTENSION_UNLOADED: { | 360 case NotificationType::EXTENSION_UNLOADED: { |
360 const Extension* extension = Details<const Extension>(details).ptr(); | 361 const Extension* extension = Details<const Extension>(details).ptr(); |
361 bool plugins_changed = false; | 362 bool plugins_changed = false; |
362 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 363 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
363 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 364 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
364 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 365 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
365 NewRunnableFunction(&ForceShutdownPlugin, | 366 NewRunnableFunction(&ForceShutdownPlugin, |
366 plugin.path)); | 367 plugin.path)); |
367 NPAPI::PluginList::Singleton()->RefreshPlugins(); | 368 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
368 NPAPI::PluginList::Singleton()->RemoveExtraPluginPath(plugin.path); | 369 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( |
| 370 plugin.path); |
369 plugins_changed = true; | 371 plugins_changed = true; |
370 if (!plugin.is_public) | 372 if (!plugin.is_public) |
371 private_plugins_.erase(plugin.path); | 373 private_plugins_.erase(plugin.path); |
372 } | 374 } |
373 if (plugins_changed) | 375 if (plugins_changed) |
374 PurgePluginListCache(false); | 376 PurgePluginListCache(false); |
375 break; | 377 break; |
376 } | 378 } |
377 | 379 |
378 #if defined(OS_MACOSX) | 380 #if defined(OS_MACOSX) |
(...skipping 26 matching lines...) Expand all Loading... |
405 // service, since we only care about this for extensions. | 407 // service, since we only care about this for extensions. |
406 const GURL& required_url = it->second; | 408 const GURL& required_url = it->second; |
407 return (url.scheme() == required_url.scheme() && | 409 return (url.scheme() == required_url.scheme() && |
408 url.host() == required_url.host()); | 410 url.host() == required_url.host()); |
409 } | 411 } |
410 | 412 |
411 void PluginService::RegisterPepperPlugins() { | 413 void PluginService::RegisterPepperPlugins() { |
412 std::vector<PepperPluginInfo> plugins; | 414 std::vector<PepperPluginInfo> plugins; |
413 PepperPluginRegistry::GetList(&plugins); | 415 PepperPluginRegistry::GetList(&plugins); |
414 for (size_t i = 0; i < plugins.size(); ++i) { | 416 for (size_t i = 0; i < plugins.size(); ++i) { |
415 NPAPI::PluginVersionInfo info; | 417 webkit::npapi::PluginVersionInfo info; |
416 info.path = plugins[i].path; | 418 info.path = plugins[i].path; |
417 info.product_name = plugins[i].name.empty() ? | 419 info.product_name = plugins[i].name.empty() ? |
418 plugins[i].path.BaseName().ToWStringHack() : | 420 plugins[i].path.BaseName().ToWStringHack() : |
419 ASCIIToWide(plugins[i].name); | 421 ASCIIToWide(plugins[i].name); |
420 info.file_description = ASCIIToWide(plugins[i].description); | 422 info.file_description = ASCIIToWide(plugins[i].description); |
421 info.file_extensions = ASCIIToWide(plugins[i].file_extensions); | 423 info.file_extensions = ASCIIToWide(plugins[i].file_extensions); |
422 info.file_description = ASCIIToWide(plugins[i].type_descriptions); | 424 info.file_description = ASCIIToWide(plugins[i].type_descriptions); |
423 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); | 425 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); |
424 | 426 |
425 // These NPAPI entry points will never be called. TODO(darin): Come up | 427 // These NPAPI entry points will never be called. TODO(darin): Come up |
426 // with a cleaner way to register pepper plugins with the NPAPI PluginList, | 428 // with a cleaner way to register pepper plugins with the NPAPI PluginList, |
427 // or perhaps refactor the PluginList to be less specific to NPAPI. | 429 // or perhaps refactor the PluginList to be less specific to NPAPI. |
428 memset(&info.entry_points, 0, sizeof(info.entry_points)); | 430 memset(&info.entry_points, 0, sizeof(info.entry_points)); |
429 | 431 |
430 NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info); | 432 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); |
431 } | 433 } |
432 } | 434 } |
OLD | NEW |