| 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_helper.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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 } | 1413 } |
| 1413 | 1414 |
| 1414 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. | 1415 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. |
| 1415 bool plugins_changed = false; | 1416 bool plugins_changed = false; |
| 1416 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1417 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 1417 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1418 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 1418 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 1419 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 1419 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); | 1420 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); |
| 1420 plugins_changed = true; | 1421 plugins_changed = true; |
| 1421 if (!plugin.is_public) { | 1422 if (!plugin.is_public) { |
| 1422 PluginService::GetInstance()->RestrictPluginToUrl( | 1423 ChromePluginServiceHelper::GetInstance()->RestrictPluginToUrl( |
| 1423 plugin.path, extension->url()); | 1424 plugin.path, extension->url()); |
| 1424 } | 1425 } |
| 1425 } | 1426 } |
| 1426 | 1427 |
| 1427 bool nacl_modules_changed = false; | 1428 bool nacl_modules_changed = false; |
| 1428 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { | 1429 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| 1429 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1430 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| 1430 RegisterNaClModule(module.url, module.mime_type); | 1431 RegisterNaClModule(module.url, module.mime_type); |
| 1431 nacl_modules_changed = true; | 1432 nacl_modules_changed = true; |
| 1432 } | 1433 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 for (size_t i = 0; i < extension->plugins().size(); ++i) { | 1497 for (size_t i = 0; i < extension->plugins().size(); ++i) { |
| 1497 const Extension::PluginInfo& plugin = extension->plugins()[i]; | 1498 const Extension::PluginInfo& plugin = extension->plugins()[i]; |
| 1498 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 1499 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 1499 NewRunnableFunction(&ForceShutdownPlugin, | 1500 NewRunnableFunction(&ForceShutdownPlugin, |
| 1500 plugin.path))) | 1501 plugin.path))) |
| 1501 NOTREACHED(); | 1502 NOTREACHED(); |
| 1502 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 1503 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 1503 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( | 1504 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( |
| 1504 plugin.path); | 1505 plugin.path); |
| 1505 plugins_changed = true; | 1506 plugins_changed = true; |
| 1506 if (!plugin.is_public) | 1507 if (!plugin.is_public) { |
| 1507 PluginService::GetInstance()->RestrictPluginToUrl(plugin.path, GURL()); | 1508 ChromePluginServiceHelper::GetInstance()->RestrictPluginToUrl( |
| 1509 plugin.path, GURL()); |
| 1510 } |
| 1508 } | 1511 } |
| 1509 | 1512 |
| 1510 bool nacl_modules_changed = false; | 1513 bool nacl_modules_changed = false; |
| 1511 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { | 1514 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { |
| 1512 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; | 1515 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; |
| 1513 UnregisterNaClModule(module.url); | 1516 UnregisterNaClModule(module.url); |
| 1514 nacl_modules_changed = true; | 1517 nacl_modules_changed = true; |
| 1515 } | 1518 } |
| 1516 | 1519 |
| 1517 if (nacl_modules_changed) | 1520 if (nacl_modules_changed) |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 | 2567 |
| 2565 ExtensionService::NaClModuleInfoList::iterator | 2568 ExtensionService::NaClModuleInfoList::iterator |
| 2566 ExtensionService::FindNaClModule(const GURL& url) { | 2569 ExtensionService::FindNaClModule(const GURL& url) { |
| 2567 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2570 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2568 iter != nacl_module_list_.end(); ++iter) { | 2571 iter != nacl_module_list_.end(); ++iter) { |
| 2569 if (iter->url == url) | 2572 if (iter->url == url) |
| 2570 return iter; | 2573 return iter; |
| 2571 } | 2574 } |
| 2572 return nacl_module_list_.end(); | 2575 return nacl_module_list_.end(); |
| 2573 } | 2576 } |
| OLD | NEW |