Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 8493026: Revert r108760 / reland r108744, r108753 w/ fix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename plugin list accessor to plugin_list() Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #include "content/browser/renderer_host/render_process_host.h" 89 #include "content/browser/renderer_host/render_process_host.h"
90 #include "content/browser/user_metrics.h" 90 #include "content/browser/user_metrics.h"
91 #include "content/common/pepper_plugin_registry.h" 91 #include "content/common/pepper_plugin_registry.h"
92 #include "content/public/browser/browser_thread.h" 92 #include "content/public/browser/browser_thread.h"
93 #include "content/public/browser/notification_service.h" 93 #include "content/public/browser/notification_service.h"
94 #include "content/public/browser/notification_types.h" 94 #include "content/public/browser/notification_types.h"
95 #include "googleurl/src/gurl.h" 95 #include "googleurl/src/gurl.h"
96 #include "net/base/registry_controlled_domain.h" 96 #include "net/base/registry_controlled_domain.h"
97 #include "webkit/database/database_tracker.h" 97 #include "webkit/database/database_tracker.h"
98 #include "webkit/database/database_util.h" 98 #include "webkit/database/database_util.h"
99 #include "webkit/plugins/npapi/plugin_list.h"
100 99
101 #if defined(OS_CHROMEOS) 100 #if defined(OS_CHROMEOS)
102 #include "chrome/browser/chromeos/cros/cros_library.h" 101 #include "chrome/browser/chromeos/cros/cros_library.h"
103 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" 102 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h"
104 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" 103 #include "chrome/browser/chromeos/extensions/input_method_event_router.h"
105 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" 104 #include "chrome/browser/chromeos/extensions/media_player_event_router.h"
106 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 105 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
107 #include "chrome/browser/extensions/extension_input_ime_api.h" 106 #include "chrome/browser/extensions/extension_input_ime_api.h"
108 #include "webkit/fileapi/file_system_context.h" 107 #include "webkit/fileapi/file_system_context.h"
109 #include "webkit/fileapi/file_system_mount_point_provider.h" 108 #include "webkit/fileapi/file_system_mount_point_provider.h"
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 // Same for chrome://thumb/ resources. 961 // Same for chrome://thumb/ resources.
963 if (extension->HasHostPermission(GURL(chrome::kChromeUIThumbnailURL))) { 962 if (extension->HasHostPermission(GURL(chrome::kChromeUIThumbnailURL))) {
964 ThumbnailSource* thumbnail_source = new ThumbnailSource(profile_); 963 ThumbnailSource* thumbnail_source = new ThumbnailSource(profile_);
965 profile_->GetChromeURLDataManager()->AddDataSource(thumbnail_source); 964 profile_->GetChromeURLDataManager()->AddDataSource(thumbnail_source);
966 } 965 }
967 966
968 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757. 967 // TODO(mpcomplete): This ends up affecting all profiles. See crbug.com/80757.
969 bool plugins_changed = false; 968 bool plugins_changed = false;
970 for (size_t i = 0; i < extension->plugins().size(); ++i) { 969 for (size_t i = 0; i < extension->plugins().size(); ++i) {
971 const Extension::PluginInfo& plugin = extension->plugins()[i]; 970 const Extension::PluginInfo& plugin = extension->plugins()[i];
972 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 971 PluginService::GetInstance()->RefreshPlugins();
973 webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path); 972 PluginService::GetInstance()->AddExtraPluginPath(plugin.path);
974 plugins_changed = true; 973 plugins_changed = true;
975 ChromePluginServiceFilter* filter = 974 ChromePluginServiceFilter* filter =
976 ChromePluginServiceFilter::GetInstance(); 975 ChromePluginServiceFilter::GetInstance();
977 if (plugin.is_public) { 976 if (plugin.is_public) {
978 filter->RestrictPluginToProfileAndOrigin( 977 filter->RestrictPluginToProfileAndOrigin(
979 plugin.path, profile_, GURL()); 978 plugin.path, profile_, GURL());
980 } else { 979 } else {
981 filter->RestrictPluginToProfileAndOrigin( 980 filter->RestrictPluginToProfileAndOrigin(
982 plugin.path, profile_, extension->url()); 981 plugin.path, profile_, extension->url());
983 } 982 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 #endif 1060 #endif
1062 1061
1063 UpdateActiveExtensionsInCrashReporter(); 1062 UpdateActiveExtensionsInCrashReporter();
1064 1063
1065 bool plugins_changed = false; 1064 bool plugins_changed = false;
1066 for (size_t i = 0; i < extension->plugins().size(); ++i) { 1065 for (size_t i = 0; i < extension->plugins().size(); ++i) {
1067 const Extension::PluginInfo& plugin = extension->plugins()[i]; 1066 const Extension::PluginInfo& plugin = extension->plugins()[i];
1068 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 1067 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
1069 base::Bind(&ForceShutdownPlugin, plugin.path))) 1068 base::Bind(&ForceShutdownPlugin, plugin.path)))
1070 NOTREACHED(); 1069 NOTREACHED();
1071 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 1070 PluginService::GetInstance()->RefreshPlugins();
1072 webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( 1071 PluginService::GetInstance()->RemoveExtraPluginPath(plugin.path);
1073 plugin.path);
1074 plugins_changed = true; 1072 plugins_changed = true;
1075 ChromePluginServiceFilter::GetInstance()->UnrestrictPlugin(plugin.path); 1073 ChromePluginServiceFilter::GetInstance()->UnrestrictPlugin(plugin.path);
1076 } 1074 }
1077 1075
1078 bool nacl_modules_changed = false; 1076 bool nacl_modules_changed = false;
1079 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) { 1077 for (size_t i = 0; i < extension->nacl_modules().size(); ++i) {
1080 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i]; 1078 const Extension::NaClModuleInfo& module = extension->nacl_modules()[i];
1081 UnregisterNaClModule(module.url); 1079 UnregisterNaClModule(module.url);
1082 nacl_modules_changed = true; 1080 nacl_modules_changed = true;
1083 } 1081 }
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 for (size_t i = 0; i < plugins.size(); ++i) { 2440 for (size_t i = 0; i < plugins.size(); ++i) {
2443 pepper_info = &plugins[i]; 2441 pepper_info = &plugins[i];
2444 CHECK(pepper_info); 2442 CHECK(pepper_info);
2445 std::vector<webkit::WebPluginMimeType>::const_iterator mime_iter; 2443 std::vector<webkit::WebPluginMimeType>::const_iterator mime_iter;
2446 // Check each MIME type the plugins handle for the NaCl MIME type. 2444 // Check each MIME type the plugins handle for the NaCl MIME type.
2447 for (mime_iter = pepper_info->mime_types.begin(); 2445 for (mime_iter = pepper_info->mime_types.begin();
2448 mime_iter != pepper_info->mime_types.end(); ++mime_iter) { 2446 mime_iter != pepper_info->mime_types.end(); ++mime_iter) {
2449 if (mime_iter->mime_type == kNaClPluginMimeType) { 2447 if (mime_iter->mime_type == kNaClPluginMimeType) {
2450 // This plugin handles "application/x-nacl". 2448 // This plugin handles "application/x-nacl".
2451 2449
2452 webkit::npapi::PluginList::Singleton()-> 2450 PluginService::GetInstance()->
2453 UnregisterInternalPlugin(pepper_info->path); 2451 UnregisterInternalPlugin(pepper_info->path);
2454 2452
2455 webkit::WebPluginInfo info = pepper_info->ToWebPluginInfo(); 2453 webkit::WebPluginInfo info = pepper_info->ToWebPluginInfo();
2456 2454
2457 for (ExtensionService::NaClModuleInfoList::const_iterator iter = 2455 for (ExtensionService::NaClModuleInfoList::const_iterator iter =
2458 nacl_module_list_.begin(); 2456 nacl_module_list_.begin();
2459 iter != nacl_module_list_.end(); ++iter) { 2457 iter != nacl_module_list_.end(); ++iter) {
2460 // Add the MIME type specified in the extension to this NaCl plugin, 2458 // Add the MIME type specified in the extension to this NaCl plugin,
2461 // With an extra "nacl" argument to specify the location of the NaCl 2459 // With an extra "nacl" argument to specify the location of the NaCl
2462 // manifest file. 2460 // manifest file.
2463 webkit::WebPluginMimeType mime_type_info; 2461 webkit::WebPluginMimeType mime_type_info;
2464 mime_type_info.mime_type = iter->mime_type; 2462 mime_type_info.mime_type = iter->mime_type;
2465 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); 2463 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl"));
2466 mime_type_info.additional_param_values.push_back( 2464 mime_type_info.additional_param_values.push_back(
2467 UTF8ToUTF16(iter->url.spec())); 2465 UTF8ToUTF16(iter->url.spec()));
2468 info.mime_types.push_back(mime_type_info); 2466 info.mime_types.push_back(mime_type_info);
2469 } 2467 }
2470 2468
2471 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 2469 PluginService::GetInstance()->RefreshPlugins();
2472 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); 2470 PluginService::GetInstance()->RegisterInternalPlugin(info);
2473 // This plugin has been modified, no need to check the rest of its 2471 // This plugin has been modified, no need to check the rest of its
2474 // types, but continue checking other plugins. 2472 // types, but continue checking other plugins.
2475 break; 2473 break;
2476 } 2474 }
2477 } 2475 }
2478 } 2476 }
2479 } 2477 }
2480 2478
2481 ExtensionService::NaClModuleInfoList::iterator 2479 ExtensionService::NaClModuleInfoList::iterator
2482 ExtensionService::FindNaClModule(const GURL& url) { 2480 ExtensionService::FindNaClModule(const GURL& url) {
2483 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2481 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2484 iter != nacl_module_list_.end(); ++iter) { 2482 iter != nacl_module_list_.end(); ++iter) {
2485 if (iter->url == url) 2483 if (iter->url == url)
2486 return iter; 2484 return iter;
2487 } 2485 }
2488 return nacl_module_list_.end(); 2486 return nacl_module_list_.end();
2489 } 2487 }
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/pepper_flash_component_installer.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698