plugin_manager.cc revision 6d86b77056ed63eb6871182f42a9fd5f07550f90
1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/files/file_path.h"
6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/lazy_instance.h"
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/path_service.h"
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/utf_string_conversions.h"
9f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "chrome/browser/extensions/extension_service.h"
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/browser/extensions/plugin_manager.h"
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/browser/profiles/profile.h"
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/common/chrome_paths.h"
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/common/extensions/api/plugins/plugins_handler.h"
15f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "chrome/common/extensions/manifest_handlers/mime_types_handler.h"
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/public/browser/plugin_service.h"
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/public/common/pepper_plugin_info.h"
180529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch#include "extensions/browser/extension_registry.h"
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "extensions/common/extension.h"
207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "url/gurl.h"
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)using content::PluginService;
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
240529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochstatic const char kNaClPluginMimeType[] = "application/x-nacl";
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace extensions {
27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)PluginManager::PluginManager(content::BrowserContext* context)
290529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    : profile_(Profile::FromBrowserContext(context)),
300529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      extension_registry_observer_(this) {
310529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)PluginManager::~PluginManager() {
35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)static base::LazyInstance<BrowserContextKeyedAPIFactory<PluginManager> >
38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    g_factory = LAZY_INSTANCE_INITIALIZER;
39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// static
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)BrowserContextKeyedAPIFactory<PluginManager>*
42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)PluginManager::GetFactoryInstance() {
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return g_factory.Pointer();
44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
460529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochvoid PluginManager::OnExtensionLoaded(content::BrowserContext* browser_context,
470529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                                      const Extension* extension) {
480529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool plugins_or_nacl_changed = false;
490529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  if (PluginInfo::HasPlugins(extension)) {
500529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    const PluginInfo::PluginVector* plugins = PluginInfo::GetPlugins(extension);
510529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    CHECK(plugins);
520529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    plugins_or_nacl_changed = true;
530529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    for (PluginInfo::PluginVector::const_iterator plugin = plugins->begin();
540529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         plugin != plugins->end();
550529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         ++plugin) {
560529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      PluginService::GetInstance()->RefreshPlugins();
570529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      PluginService::GetInstance()->AddExtraPluginPath(plugin->path);
580529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      ChromePluginServiceFilter* filter =
590529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch          ChromePluginServiceFilter::GetInstance();
600529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      if (plugin->is_public) {
610529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch        filter->RestrictPluginToProfileAndOrigin(
620529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch            plugin->path, profile_, GURL());
630529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      } else {
640529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch        filter->RestrictPluginToProfileAndOrigin(
650529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch            plugin->path, profile_, extension->url());
66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      }
67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    }
680529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  }
69868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
700529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  const NaClModuleInfo::List* nacl_modules =
710529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      NaClModuleInfo::GetNaClModules(extension);
720529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  if (nacl_modules) {
730529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    plugins_or_nacl_changed = true;
740529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    for (NaClModuleInfo::List::const_iterator module = nacl_modules->begin();
750529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         module != nacl_modules->end();
760529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         ++module) {
770529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      RegisterNaClModule(*module);
78868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    }
790529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    UpdatePluginListWithNaClModules();
800529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  }
81868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
82f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  const MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension);
83f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  if (handler && !handler->handler_url().empty()) {
84f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    plugins_or_nacl_changed = true;
856d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
866d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    content::WebPluginInfo info;
876d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN;
886d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    info.name = base::UTF8ToUTF16(handler->extension_id());
896d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    info.path = base::FilePath::FromUTF8Unsafe(handler->extension_id());
906d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
916d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    for (std::set<std::string>::const_iterator mime_type =
926d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)         handler->mime_type_set().begin();
936d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)         mime_type != handler->mime_type_set().end(); ++mime_type) {
946d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      content::WebPluginMimeType mime_type_info;
956d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      mime_type_info.mime_type = *mime_type;
966d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      info.mime_types.push_back(mime_type_info);
976d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    }
986d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
996d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    PluginService::GetInstance()->RefreshPlugins();
1006d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    PluginService::GetInstance()->RegisterInternalPlugin(info, true);
101f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  }
102f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
1030529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  if (plugins_or_nacl_changed)
1040529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    PluginService::GetInstance()->PurgePluginListCache(profile_, false);
1050529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch}
106868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
1070529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochvoid PluginManager::OnExtensionUnloaded(
1080529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    content::BrowserContext* browser_context,
1090529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    const Extension* extension,
1100529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    UnloadedExtensionInfo::Reason reason) {
1110529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool plugins_or_nacl_changed = false;
1120529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  if (PluginInfo::HasPlugins(extension)) {
1130529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    const PluginInfo::PluginVector* plugins = PluginInfo::GetPlugins(extension);
1140529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    plugins_or_nacl_changed = true;
1150529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    for (PluginInfo::PluginVector::const_iterator plugin = plugins->begin();
1160529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         plugin != plugins->end();
1170529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         ++plugin) {
1180529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      PluginService::GetInstance()->ForcePluginShutdown(plugin->path);
1190529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      PluginService::GetInstance()->RefreshPlugins();
1200529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      PluginService::GetInstance()->RemoveExtraPluginPath(plugin->path);
1210529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      ChromePluginServiceFilter::GetInstance()->UnrestrictPlugin(plugin->path);
122868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    }
1230529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  }
124868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
1250529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  const NaClModuleInfo::List* nacl_modules =
1260529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      NaClModuleInfo::GetNaClModules(extension);
1270529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  if (nacl_modules) {
1280529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    plugins_or_nacl_changed = true;
1290529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    for (NaClModuleInfo::List::const_iterator module = nacl_modules->begin();
1300529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         module != nacl_modules->end();
1310529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch         ++module) {
1320529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      UnregisterNaClModule(*module);
1330529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    }
1340529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    UpdatePluginListWithNaClModules();
135868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
1360529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
137f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  const MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension);
138f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  if (handler && !handler->handler_url().empty()) {
139f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    plugins_or_nacl_changed = true;
1406d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    base::FilePath path =
1416d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)        base::FilePath::FromUTF8Unsafe(handler->extension_id());
1426d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    PluginService::GetInstance()->UnregisterInternalPlugin(path);
1436d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    PluginService::GetInstance()->ForcePluginShutdown(path);
1446d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    PluginService::GetInstance()->RefreshPlugins();
145f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  }
146f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
1470529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  if (plugins_or_nacl_changed)
1480529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch    PluginService::GetInstance()->PurgePluginListCache(profile_, false);
149868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
150868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
151868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)void PluginManager::RegisterNaClModule(const NaClModuleInfo& info) {
152868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  DCHECK(FindNaClModule(info.url) == nacl_module_list_.end());
153868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  nacl_module_list_.push_front(info);
154868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
155868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
156868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)void PluginManager::UnregisterNaClModule(const NaClModuleInfo& info) {
157868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  NaClModuleInfo::List::iterator iter = FindNaClModule(info.url);
158868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  DCHECK(iter != nacl_module_list_.end());
159868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  nacl_module_list_.erase(iter);
160868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
161868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
162868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)void PluginManager::UpdatePluginListWithNaClModules() {
163868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // An extension has been added which has a nacl_module component, which means
164868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // there is a MIME type that module wants to handle, so we need to add that
165868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // MIME type to plugins which handle NaCl modules in order to allow the
166868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // individual modules to handle these types.
167868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  base::FilePath path;
168868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  if (!PathService::Get(chrome::FILE_NACL_PLUGIN, &path))
169868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    return;
170868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  const content::PepperPluginInfo* pepper_info =
171868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(path);
172868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  if (!pepper_info)
173868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    return;
174868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
175ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  std::vector<content::WebPluginMimeType>::const_iterator mime_iter;
176868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Check each MIME type the plugins handle for the NaCl MIME type.
177868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  for (mime_iter = pepper_info->mime_types.begin();
178868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)       mime_iter != pepper_info->mime_types.end(); ++mime_iter) {
179868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    if (mime_iter->mime_type == kNaClPluginMimeType) {
180868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      // This plugin handles "application/x-nacl".
181868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
182868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      PluginService::GetInstance()->UnregisterInternalPlugin(pepper_info->path);
183868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
184ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      content::WebPluginInfo info = pepper_info->ToWebPluginInfo();
185868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
186868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      for (NaClModuleInfo::List::const_iterator iter =
187868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)               nacl_module_list_.begin();
188868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)           iter != nacl_module_list_.end(); ++iter) {
189868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        // Add the MIME type specified in the extension to this NaCl plugin,
190868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        // With an extra "nacl" argument to specify the location of the NaCl
191868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        // manifest file.
192ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch        content::WebPluginMimeType mime_type_info;
193868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        mime_type_info.mime_type = iter->mime_type;
1945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        mime_type_info.additional_param_names.push_back(
1955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)            base::UTF8ToUTF16("nacl"));
196868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        mime_type_info.additional_param_values.push_back(
1975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)            base::UTF8ToUTF16(iter->url.spec()));
198868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)        info.mime_types.push_back(mime_type_info);
199868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      }
200868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
201868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      PluginService::GetInstance()->RefreshPlugins();
202868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      PluginService::GetInstance()->RegisterInternalPlugin(info, true);
203868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      // This plugin has been modified, no need to check the rest of its
204868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      // types, but continue checking other plugins.
205868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      break;
206868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    }
207868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
208868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
209868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
210868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) {
211868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin();
212868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)       iter != nacl_module_list_.end(); ++iter) {
213868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    if (iter->url == url)
214868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      return iter;
215868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
216868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  return nacl_module_list_.end();
217868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
218868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
219868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // namespace extensions
220