| 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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 } | 1422 } |
| 1422 | 1423 |
| 1423 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. | 1424 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. |
| 1424 bool plugins_changed = false; | 1425 bool plugins_changed = false; |
| 1425 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1426 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 1426 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1427 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 1427 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 1428 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 1428 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); | 1429 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); |
| 1429 plugins_changed = true; | 1430 plugins_changed = true; |
| 1430 if (!plugin.is_public) { | 1431 if (!plugin.is_public) { |
| 1431 PluginService::GetInstance()->RestrictPluginToUrl( | 1432 ChromePluginServiceFilter::GetInstance()->RestrictPluginToUrl( |
| 1432 plugin.path, extension->url()); | 1433 plugin.path, extension->url()); |
| 1433 } | 1434 } |
| 1434 } | 1435 } |
| 1435 | 1436 |
| 1436 bool nacl_modules_changed = false; | 1437 bool nacl_modules_changed = false; |
| 1437 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { | 1438 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| 1438 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1439 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| 1439 RegisterNaClModule(module.url, module.mime_type); | 1440 RegisterNaClModule(module.url, module.mime_type); |
| 1440 nacl_modules_changed = true; | 1441 nacl_modules_changed = true; |
| 1441 } | 1442 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1514 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 1514 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1515 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 1515 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 1516 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 1516 NewRunnableFunction(&ForceShutdownPlugin, | 1517 NewRunnableFunction(&ForceShutdownPlugin, |
| 1517 plugin.path))) | 1518 plugin.path))) |
| 1518 NOTREACHED(); | 1519 NOTREACHED(); |
| 1519 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 1520 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 1520 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( | 1521 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( |
| 1521 plugin.path); | 1522 plugin.path); |
| 1522 plugins_changed = true; | 1523 plugins_changed = true; |
| 1523 if (!plugin.is_public) | 1524 if (!plugin.is_public) { |
| 1524 PluginService::GetInstance()->RestrictPluginToUrl(plugin.path, GURL()); | 1525 ChromePluginServiceFilter::GetInstance()->RestrictPluginToUrl( |
| 1526 plugin.path, GURL()); |
| 1527 } |
| 1525 } | 1528 } |
| 1526 | 1529 |
| 1527 bool nacl_modules_changed = false; | 1530 bool nacl_modules_changed = false; |
| 1528 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { | 1531 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| 1529 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1532 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| 1530 UnregisterNaClModule(module.url); | 1533 UnregisterNaClModule(module.url); |
| 1531 nacl_modules_changed = true; | 1534 nacl_modules_changed = true; |
| 1532 } | 1535 } |
| 1533 | 1536 |
| 1534 if (nacl_modules_changed) | 1537 if (nacl_modules_changed) |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2581 | 2584 |
| 2582 ExtensionService::NaClModuleInfoList::iterator | 2585 ExtensionService::NaClModuleInfoList::iterator |
| 2583 ExtensionService::FindNaClModule(const GURL& url) { | 2586 ExtensionService::FindNaClModule(const GURL& url) { |
| 2584 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2587 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2585 iter != nacl_module_list_.end(); ++iter) { | 2588 iter != nacl_module_list_.end(); ++iter) { |
| 2586 if (iter->url == url) | 2589 if (iter->url == url) |
| 2587 return iter; | 2590 return iter; |
| 2588 } | 2591 } |
| 2589 return nacl_module_list_.end(); | 2592 return nacl_module_list_.end(); |
| 2590 } | 2593 } |
| OLD | NEW |