| 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 | |
| 41 #ifndef DISABLE_NACL | 37 #ifndef DISABLE_NACL |
| 42 #include "native_client/src/trusted/plugin/nacl_entry_points.h" | 38 #include "native_client/src/trusted/plugin/nacl_entry_points.h" |
| 43 #endif | 39 #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" |
| 44 | 43 |
| 45 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 46 #include "chrome/browser/chromeos/plugin_selection_policy.h" | 45 #include "chrome/browser/chromeos/plugin_selection_policy.h" |
| 47 #endif | 46 #endif |
| 48 | 47 |
| 49 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 50 static void NotifyPluginsOfActivation() { | 49 static void NotifyPluginsOfActivation() { |
| 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 52 | 51 |
| 53 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); | 52 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 ui_locale_(g_browser_process->GetApplicationLocale()) { | 87 ui_locale_(g_browser_process->GetApplicationLocale()) { |
| 89 RegisterPepperPlugins(); | 88 RegisterPepperPlugins(); |
| 90 | 89 |
| 91 // Have the NPAPI plugin list search for Chrome plugins as well. | 90 // Have the NPAPI plugin list search for Chrome plugins as well. |
| 92 ChromePluginLib::RegisterPluginsWithNPAPI(); | 91 ChromePluginLib::RegisterPluginsWithNPAPI(); |
| 93 | 92 |
| 94 // Load any specified on the command line as well. | 93 // Load any specified on the command line as well. |
| 95 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 94 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 96 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); | 95 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); |
| 97 if (!path.empty()) | 96 if (!path.empty()) |
| 98 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); | 97 NPAPI::PluginList::Singleton()->AddExtraPluginPath(path); |
| 99 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); | 98 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); |
| 100 if (!path.empty()) | 99 if (!path.empty()) |
| 101 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(path); | 100 NPAPI::PluginList::Singleton()->AddExtraPluginDir(path); |
| 102 | 101 |
| 103 chrome::RegisterInternalDefaultPlugin(); | 102 chrome::RegisterInternalDefaultPlugin(); |
| 104 | 103 |
| 105 // Register the internal Flash and PDF, if available. | 104 // Register the internal Flash and PDF, if available. |
| 106 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 105 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 107 switches::kDisableInternalFlash) && | 106 switches::kDisableInternalFlash) && |
| 108 PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) { | 107 PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) { |
| 109 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); | 108 NPAPI::PluginList::Singleton()->AddExtraPluginPath(path); |
| 110 } | 109 } |
| 111 | 110 |
| 112 #ifndef DISABLE_NACL | 111 #ifndef DISABLE_NACL |
| 113 if (command_line->HasSwitch(switches::kInternalNaCl)) { | 112 if (command_line->HasSwitch(switches::kInternalNaCl)) { |
| 114 RegisterInternalNaClPlugin(); | 113 RegisterInternalNaClPlugin(); |
| 115 } | 114 } |
| 116 #endif | 115 #endif |
| 117 | 116 |
| 118 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
| 119 plugin_selection_policy_ = new chromeos::PluginSelectionPolicy; | 118 plugin_selection_policy_ = new chromeos::PluginSelectionPolicy; |
| 120 plugin_selection_policy_->StartInit(); | 119 plugin_selection_policy_->StartInit(); |
| 121 #endif | 120 #endif |
| 122 | 121 |
| 123 chrome::RegisterInternalGPUPlugin(); | 122 chrome::RegisterInternalGPUPlugin(); |
| 124 | 123 |
| 125 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
| 126 hkcu_key_.Create( | 125 hkcu_key_.Create( |
| 127 HKEY_CURRENT_USER, webkit::npapi::kRegistryMozillaPlugins, KEY_NOTIFY); | 126 HKEY_CURRENT_USER, kRegistryMozillaPlugins, KEY_NOTIFY); |
| 128 hklm_key_.Create( | 127 hklm_key_.Create( |
| 129 HKEY_LOCAL_MACHINE, webkit::npapi::kRegistryMozillaPlugins, KEY_NOTIFY); | 128 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, KEY_NOTIFY); |
| 130 if (hkcu_key_.StartWatching()) { | 129 if (hkcu_key_.StartWatching()) { |
| 131 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); | 130 hkcu_event_.reset(new base::WaitableEvent(hkcu_key_.watch_event())); |
| 132 hkcu_watcher_.StartWatching(hkcu_event_.get(), this); | 131 hkcu_watcher_.StartWatching(hkcu_event_.get(), this); |
| 133 } | 132 } |
| 134 | 133 |
| 135 if (hklm_key_.StartWatching()) { | 134 if (hklm_key_.StartWatching()) { |
| 136 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); | 135 hklm_event_.reset(new base::WaitableEvent(hklm_key_.watch_event())); |
| 137 hklm_watcher_.StartWatching(hklm_event_.get(), this); | 136 hklm_watcher_.StartWatching(hklm_event_.get(), this); |
| 138 } | 137 } |
| 139 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 138 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
| 140 // Also find plugins in a user-specific plugins dir, | 139 // Also find plugins in a user-specific plugins dir, |
| 141 // e.g. ~/.config/chromium/Plugins. | 140 // e.g. ~/.config/chromium/Plugins. |
| 142 FilePath user_data_dir; | 141 FilePath user_data_dir; |
| 143 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | 142 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
| 144 webkit::npapi::PluginList::Singleton()->AddExtraPluginDir( | 143 NPAPI::PluginList::Singleton()->AddExtraPluginDir( |
| 145 user_data_dir.Append("Plugins")); | 144 user_data_dir.Append("Plugins")); |
| 146 } | 145 } |
| 147 #endif | 146 #endif |
| 148 | 147 |
| 149 registrar_.Add(this, NotificationType::EXTENSION_LOADED, | 148 registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
| 150 NotificationService::AllSources()); | 149 NotificationService::AllSources()); |
| 151 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 150 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
| 152 NotificationService::AllSources()); | 151 NotificationService::AllSources()); |
| 153 #if defined(OS_MACOSX) | 152 #if defined(OS_MACOSX) |
| 154 // We need to know when the browser comes forward so we can bring modal plugin | 153 // 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... |
| 206 } | 205 } |
| 207 | 206 |
| 208 PluginProcessHost* PluginService::FindOrStartPluginProcess( | 207 PluginProcessHost* PluginService::FindOrStartPluginProcess( |
| 209 const FilePath& plugin_path) { | 208 const FilePath& plugin_path) { |
| 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 211 | 210 |
| 212 PluginProcessHost* plugin_host = FindPluginProcess(plugin_path); | 211 PluginProcessHost* plugin_host = FindPluginProcess(plugin_path); |
| 213 if (plugin_host) | 212 if (plugin_host) |
| 214 return plugin_host; | 213 return plugin_host; |
| 215 | 214 |
| 216 webkit::npapi::WebPluginInfo info; | 215 WebPluginInfo info; |
| 217 if (!webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath( | 216 if (!NPAPI::PluginList::Singleton()->GetPluginInfoByPath( |
| 218 plugin_path, &info)) { | 217 plugin_path, &info)) { |
| 219 return NULL; | 218 return NULL; |
| 220 } | 219 } |
| 221 | 220 |
| 222 // This plugin isn't loaded by any plugin process, so create a new process. | 221 // This plugin isn't loaded by any plugin process, so create a new process. |
| 223 scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost()); | 222 scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost()); |
| 224 if (!new_host->Init(info, ui_locale_)) { | 223 if (!new_host->Init(info, ui_locale_)) { |
| 225 NOTREACHED(); // Init is not expected to fail | 224 NOTREACHED(); // Init is not expected to fail |
| 226 return NULL; | 225 return NULL; |
| 227 } | 226 } |
| 228 | 227 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 240 NewRunnableMethod( | 239 NewRunnableMethod( |
| 241 this, &PluginService::GetAllowedPluginForOpenChannelToPlugin, | 240 this, &PluginService::GetAllowedPluginForOpenChannelToPlugin, |
| 242 url, mime_type, client)); | 241 url, mime_type, client)); |
| 243 } | 242 } |
| 244 | 243 |
| 245 void PluginService::GetAllowedPluginForOpenChannelToPlugin( | 244 void PluginService::GetAllowedPluginForOpenChannelToPlugin( |
| 246 const GURL& url, | 245 const GURL& url, |
| 247 const std::string& mime_type, | 246 const std::string& mime_type, |
| 248 PluginProcessHost::Client* client) { | 247 PluginProcessHost::Client* client) { |
| 249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 250 webkit::npapi::WebPluginInfo info; | 249 WebPluginInfo info; |
| 251 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); | 250 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); |
| 252 FilePath plugin_path; | 251 FilePath plugin_path; |
| 253 if (found && info.enabled) | 252 if (found && info.enabled) |
| 254 plugin_path = FilePath(info.path); | 253 plugin_path = FilePath(info.path); |
| 255 | 254 |
| 256 // Now we jump back to the IO thread to finish opening the channel. | 255 // Now we jump back to the IO thread to finish opening the channel. |
| 257 BrowserThread::PostTask( | 256 BrowserThread::PostTask( |
| 258 BrowserThread::IO, FROM_HERE, | 257 BrowserThread::IO, FROM_HERE, |
| 259 NewRunnableMethod( | 258 NewRunnableMethod( |
| 260 this, &PluginService::FinishOpenChannelToPlugin, | 259 this, &PluginService::FinishOpenChannelToPlugin, |
| 261 plugin_path, client)); | 260 plugin_path, client)); |
| 262 } | 261 } |
| 263 | 262 |
| 264 void PluginService::FinishOpenChannelToPlugin( | 263 void PluginService::FinishOpenChannelToPlugin( |
| 265 const FilePath& plugin_path, | 264 const FilePath& plugin_path, |
| 266 PluginProcessHost::Client* client) { | 265 PluginProcessHost::Client* client) { |
| 267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 266 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 268 | 267 |
| 269 PluginProcessHost* plugin_host = FindOrStartPluginProcess(plugin_path); | 268 PluginProcessHost* plugin_host = FindOrStartPluginProcess(plugin_path); |
| 270 if (plugin_host) | 269 if (plugin_host) |
| 271 plugin_host->OpenChannelToPlugin(client); | 270 plugin_host->OpenChannelToPlugin(client); |
| 272 else | 271 else |
| 273 client->OnError(); | 272 client->OnError(); |
| 274 } | 273 } |
| 275 | 274 |
| 276 bool PluginService::GetFirstAllowedPluginInfo( | 275 bool PluginService::GetFirstAllowedPluginInfo( |
| 277 const GURL& url, | 276 const GURL& url, |
| 278 const std::string& mime_type, | 277 const std::string& mime_type, |
| 279 webkit::npapi::WebPluginInfo* info, | 278 WebPluginInfo* info, |
| 280 std::string* actual_mime_type) { | 279 std::string* actual_mime_type) { |
| 281 // GetPluginInfoArray may need to load the plugins, so we need to be | 280 // GetPluginInfoArray may need to load the plugins, so we need to be |
| 282 // on the FILE thread. | 281 // on the FILE thread. |
| 283 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 282 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 284 bool allow_wildcard = true; | 283 bool allow_wildcard = true; |
| 285 #if defined(OS_CHROMEOS) | 284 #if defined(OS_CHROMEOS) |
| 286 std::vector<webkit::npapi::WebPluginInfo> info_array; | 285 std::vector<WebPluginInfo> info_array; |
| 287 std::vector<std::string> actual_mime_types; | 286 std::vector<std::string> actual_mime_types; |
| 288 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( | 287 NPAPI::PluginList::Singleton()->GetPluginInfoArray( |
| 289 url, mime_type, allow_wildcard, &info_array, &actual_mime_types); | 288 url, mime_type, allow_wildcard, &info_array, &actual_mime_types); |
| 290 | 289 |
| 291 // Now we filter by the plugin selection policy. | 290 // Now we filter by the plugin selection policy. |
| 292 int allowed_index = plugin_selection_policy_->FindFirstAllowed(url, | 291 int allowed_index = plugin_selection_policy_->FindFirstAllowed(url, |
| 293 info_array); | 292 info_array); |
| 294 if (!info_array.empty() && allowed_index >= 0) { | 293 if (!info_array.empty() && allowed_index >= 0) { |
| 295 *info = info_array[allowed_index]; | 294 *info = info_array[allowed_index]; |
| 296 if (actual_mime_type) | 295 if (actual_mime_type) |
| 297 *actual_mime_type = actual_mime_types[allowed_index]; | 296 *actual_mime_type = actual_mime_types[allowed_index]; |
| 298 return true; | 297 return true; |
| 299 } | 298 } |
| 300 return false; | 299 return false; |
| 301 #else | 300 #else |
| 302 return webkit::npapi::PluginList::Singleton()->GetPluginInfo( | 301 return NPAPI::PluginList::Singleton()->GetPluginInfo( |
| 303 url, mime_type, allow_wildcard, info, actual_mime_type); | 302 url, mime_type, allow_wildcard, info, actual_mime_type); |
| 304 #endif | 303 #endif |
| 305 } | 304 } |
| 306 | 305 |
| 307 static void PurgePluginListCache(bool reload_pages) { | 306 static void PurgePluginListCache(bool reload_pages) { |
| 308 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); | 307 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); |
| 309 !it.IsAtEnd(); it.Advance()) { | 308 !it.IsAtEnd(); it.Advance()) { |
| 310 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); | 309 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); |
| 311 } | 310 } |
| 312 } | 311 } |
| 313 | 312 |
| 314 void PluginService::OnWaitableEventSignaled( | 313 void PluginService::OnWaitableEventSignaled( |
| 315 base::WaitableEvent* waitable_event) { | 314 base::WaitableEvent* waitable_event) { |
| 316 #if defined(OS_WIN) | 315 #if defined(OS_WIN) |
| 317 if (waitable_event == hkcu_event_.get()) { | 316 if (waitable_event == hkcu_event_.get()) { |
| 318 hkcu_key_.StartWatching(); | 317 hkcu_key_.StartWatching(); |
| 319 } else { | 318 } else { |
| 320 hklm_key_.StartWatching(); | 319 hklm_key_.StartWatching(); |
| 321 } | 320 } |
| 322 | 321 |
| 323 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 322 NPAPI::PluginList::Singleton()->RefreshPlugins(); |
| 324 PurgePluginListCache(true); | 323 PurgePluginListCache(true); |
| 325 #endif // defined(OS_WIN) | 324 #endif // defined(OS_WIN) |
| 326 } | 325 } |
| 327 | 326 |
| 328 static void ForceShutdownPlugin(const FilePath& plugin_path) { | 327 static void ForceShutdownPlugin(const FilePath& plugin_path) { |
| 329 PluginProcessHost* plugin = | 328 PluginProcessHost* plugin = |
| 330 PluginService::GetInstance()->FindPluginProcess(plugin_path); | 329 PluginService::GetInstance()->FindPluginProcess(plugin_path); |
| 331 if (plugin) | 330 if (plugin) |
| 332 plugin->ForceShutdown(); | 331 plugin->ForceShutdown(); |
| 333 } | 332 } |
| 334 | 333 |
| 335 void PluginService::Observe(NotificationType type, | 334 void PluginService::Observe(NotificationType type, |
| 336 const NotificationSource& source, | 335 const NotificationSource& source, |
| 337 const NotificationDetails& details) { | 336 const NotificationDetails& details) { |
| 338 switch (type.value) { | 337 switch (type.value) { |
| 339 case NotificationType::EXTENSION_LOADED: { | 338 case NotificationType::EXTENSION_LOADED: { |
| 340 const Extension* extension = Details<const Extension>(details).ptr(); | 339 const Extension* extension = Details<const Extension>(details).ptr(); |
| 341 bool plugins_changed = false; | 340 bool plugins_changed = false; |
| 342 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 341 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 343 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 342 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 344 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 343 NPAPI::PluginList::Singleton()->RefreshPlugins(); |
| 345 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); | 344 NPAPI::PluginList::Singleton()->AddExtraPluginPath(plugin.path); |
| 346 plugins_changed = true; | 345 plugins_changed = true; |
| 347 if (!plugin.is_public) | 346 if (!plugin.is_public) |
| 348 private_plugins_[plugin.path] = extension->url(); | 347 private_plugins_[plugin.path] = extension->url(); |
| 349 } | 348 } |
| 350 if (plugins_changed) | 349 if (plugins_changed) |
| 351 PurgePluginListCache(false); | 350 PurgePluginListCache(false); |
| 352 break; | 351 break; |
| 353 } | 352 } |
| 354 | 353 |
| 355 case NotificationType::EXTENSION_UNLOADED: { | 354 case NotificationType::EXTENSION_UNLOADED: { |
| 356 const Extension* extension = Details<const Extension>(details).ptr(); | 355 const Extension* extension = Details<const Extension>(details).ptr(); |
| 357 bool plugins_changed = false; | 356 bool plugins_changed = false; |
| 358 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 357 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 359 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 358 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 360 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 359 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 361 NewRunnableFunction(&ForceShutdownPlugin, | 360 NewRunnableFunction(&ForceShutdownPlugin, |
| 362 plugin.path)); | 361 plugin.path)); |
| 363 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 362 NPAPI::PluginList::Singleton()->RefreshPlugins(); |
| 364 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( | 363 NPAPI::PluginList::Singleton()->RemoveExtraPluginPath(plugin.path); |
| 365 plugin.path); | |
| 366 plugins_changed = true; | 364 plugins_changed = true; |
| 367 if (!plugin.is_public) | 365 if (!plugin.is_public) |
| 368 private_plugins_.erase(plugin.path); | 366 private_plugins_.erase(plugin.path); |
| 369 } | 367 } |
| 370 if (plugins_changed) | 368 if (plugins_changed) |
| 371 PurgePluginListCache(false); | 369 PurgePluginListCache(false); |
| 372 break; | 370 break; |
| 373 } | 371 } |
| 374 | 372 |
| 375 #if defined(OS_MACOSX) | 373 #if defined(OS_MACOSX) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 402 // service, since we only care about this for extensions. | 400 // service, since we only care about this for extensions. |
| 403 const GURL& required_url = it->second; | 401 const GURL& required_url = it->second; |
| 404 return (url.scheme() == required_url.scheme() && | 402 return (url.scheme() == required_url.scheme() && |
| 405 url.host() == required_url.host()); | 403 url.host() == required_url.host()); |
| 406 } | 404 } |
| 407 | 405 |
| 408 void PluginService::RegisterPepperPlugins() { | 406 void PluginService::RegisterPepperPlugins() { |
| 409 std::vector<PepperPluginInfo> plugins; | 407 std::vector<PepperPluginInfo> plugins; |
| 410 PepperPluginRegistry::GetList(&plugins); | 408 PepperPluginRegistry::GetList(&plugins); |
| 411 for (size_t i = 0; i < plugins.size(); ++i) { | 409 for (size_t i = 0; i < plugins.size(); ++i) { |
| 412 webkit::npapi::PluginVersionInfo info; | 410 NPAPI::PluginVersionInfo info; |
| 413 info.path = plugins[i].path; | 411 info.path = plugins[i].path; |
| 414 info.product_name = plugins[i].name.empty() ? | 412 info.product_name = plugins[i].name.empty() ? |
| 415 plugins[i].path.BaseName().ToWStringHack() : | 413 plugins[i].path.BaseName().ToWStringHack() : |
| 416 ASCIIToWide(plugins[i].name); | 414 ASCIIToWide(plugins[i].name); |
| 417 info.file_description = ASCIIToWide(plugins[i].description); | 415 info.file_description = ASCIIToWide(plugins[i].description); |
| 418 info.file_extensions = ASCIIToWide(plugins[i].file_extensions); | 416 info.file_extensions = ASCIIToWide(plugins[i].file_extensions); |
| 419 info.file_description = ASCIIToWide(plugins[i].type_descriptions); | 417 info.file_description = ASCIIToWide(plugins[i].type_descriptions); |
| 420 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); | 418 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); |
| 421 | 419 |
| 422 // These NPAPI entry points will never be called. TODO(darin): Come up | 420 // These NPAPI entry points will never be called. TODO(darin): Come up |
| 423 // with a cleaner way to register pepper plugins with the NPAPI PluginList, | 421 // with a cleaner way to register pepper plugins with the NPAPI PluginList, |
| 424 // or perhaps refactor the PluginList to be less specific to NPAPI. | 422 // or perhaps refactor the PluginList to be less specific to NPAPI. |
| 425 memset(&info.entry_points, 0, sizeof(info.entry_points)); | 423 memset(&info.entry_points, 0, sizeof(info.entry_points)); |
| 426 | 424 |
| 427 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); | 425 NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info); |
| 428 } | 426 } |
| 429 } | 427 } |
| OLD | NEW |