| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
| 21 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
| 22 #include "base/time.h" | 22 #include "base/time.h" |
| 23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "base/version.h" | 25 #include "base/version.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 27 #include "chrome/browser/extensions/apps_promo.h" | 28 #include "chrome/browser/extensions/apps_promo.h" |
| 28 #include "chrome/browser/extensions/crx_installer.h" | 29 #include "chrome/browser/extensions/crx_installer.h" |
| 29 #include "chrome/browser/extensions/extension_accessibility_api.h" | 30 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 30 #include "chrome/browser/extensions/extension_bookmarks_module.h" | 31 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 31 #include "chrome/browser/extensions/extension_browser_event_router.h" | 32 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 32 #include "chrome/browser/extensions/extension_cookies_api.h" | 33 #include "chrome/browser/extensions/extension_cookies_api.h" |
| 33 #include "chrome/browser/extensions/extension_data_deleter.h" | 34 #include "chrome/browser/extensions/extension_data_deleter.h" |
| 34 #include "chrome/browser/extensions/extension_error_reporter.h" | 35 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 35 #include "chrome/browser/extensions/extension_history_api.h" | 36 #include "chrome/browser/extensions/extension_history_api.h" |
| 36 #include "chrome/browser/extensions/extension_host.h" | 37 #include "chrome/browser/extensions/extension_host.h" |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 } | 1496 } |
| 1496 | 1497 |
| 1497 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. | 1498 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. |
| 1498 bool plugins_changed = false; | 1499 bool plugins_changed = false; |
| 1499 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1500 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 1500 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1501 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 1501 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 1502 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 1502 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); | 1503 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); |
| 1503 plugins_changed = true; | 1504 plugins_changed = true; |
| 1504 if (!plugin.is_public) { | 1505 if (!plugin.is_public) { |
| 1505 PluginService::GetInstance()->RestrictPluginToUrl( | 1506 ChromePluginServiceFilter::GetInstance()->RestrictPluginToUrl( |
| 1506 plugin.path, extension->url()); | 1507 plugin.path, extension->url()); |
| 1507 } | 1508 } |
| 1508 } | 1509 } |
| 1509 | 1510 |
| 1510 bool nacl_modules_changed = false; | 1511 bool nacl_modules_changed = false; |
| 1511 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { | 1512 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| 1512 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1513 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| 1513 RegisterNaClModule(module.url, module.mime_type); | 1514 RegisterNaClModule(module.url, module.mime_type); |
| 1514 nacl_modules_changed = true; | 1515 nacl_modules_changed = true; |
| 1515 } | 1516 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1591 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 1591 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1592 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 1592 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 1593 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 1593 NewRunnableFunction(&ForceShutdownPlugin, | 1594 NewRunnableFunction(&ForceShutdownPlugin, |
| 1594 plugin.path))) | 1595 plugin.path))) |
| 1595 NOTREACHED(); | 1596 NOTREACHED(); |
| 1596 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 1597 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 1597 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( | 1598 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( |
| 1598 plugin.path); | 1599 plugin.path); |
| 1599 plugins_changed = true; | 1600 plugins_changed = true; |
| 1600 if (!plugin.is_public) | 1601 if (!plugin.is_public) { |
| 1601 PluginService::GetInstance()->RestrictPluginToUrl(plugin.path, GURL()); | 1602 ChromePluginServiceFilter::GetInstance()->RestrictPluginToUrl( |
| 1603 plugin.path, GURL()); |
| 1604 } |
| 1602 } | 1605 } |
| 1603 | 1606 |
| 1604 bool nacl_modules_changed = false; | 1607 bool nacl_modules_changed = false; |
| 1605 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { | 1608 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| 1606 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1609 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| 1607 UnregisterNaClModule(module.url); | 1610 UnregisterNaClModule(module.url); |
| 1608 nacl_modules_changed = true; | 1611 nacl_modules_changed = true; |
| 1609 } | 1612 } |
| 1610 | 1613 |
| 1611 if (nacl_modules_changed) | 1614 if (nacl_modules_changed) |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2868 | 2871 |
| 2869 ExtensionService::NaClModuleInfoList::iterator | 2872 ExtensionService::NaClModuleInfoList::iterator |
| 2870 ExtensionService::FindNaClModule(const GURL& url) { | 2873 ExtensionService::FindNaClModule(const GURL& url) { |
| 2871 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2874 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2872 iter != nacl_module_list_.end(); ++iter) { | 2875 iter != nacl_module_list_.end(); ++iter) { |
| 2873 if (iter->url == url) | 2876 if (iter->url == url) |
| 2874 return iter; | 2877 return iter; |
| 2875 } | 2878 } |
| 2876 return nacl_module_list_.end(); | 2879 return nacl_module_list_.end(); |
| 2877 } | 2880 } |
| OLD | NEW |