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

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

Issue 7648017: Make WebPluginInfo more generic (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months 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 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 const PepperPluginInfo* pepper_info = NULL; 2550 const PepperPluginInfo* pepper_info = NULL;
2551 std::vector<PepperPluginInfo> plugins; 2551 std::vector<PepperPluginInfo> plugins;
2552 PepperPluginRegistry::ComputeList(&plugins); 2552 PepperPluginRegistry::ComputeList(&plugins);
2553 2553
2554 // Search the entire plugin list for plugins that handle the NaCl MIME type. 2554 // Search the entire plugin list for plugins that handle the NaCl MIME type.
2555 // There can be multiple plugins like this, for instance the internal NaCl 2555 // There can be multiple plugins like this, for instance the internal NaCl
2556 // plugin and a plugin registered by --register-pepper-plugins during tests. 2556 // plugin and a plugin registered by --register-pepper-plugins during tests.
2557 for (size_t i = 0; i < plugins.size(); ++i) { 2557 for (size_t i = 0; i < plugins.size(); ++i) {
2558 pepper_info = &plugins[i]; 2558 pepper_info = &plugins[i];
2559 CHECK(pepper_info); 2559 CHECK(pepper_info);
2560 std::vector<webkit::npapi::WebPluginMimeType>::const_iterator mime_iter; 2560 std::vector<webkit::WebPluginMimeType>::const_iterator mime_iter;
2561 // Check each MIME type the plugins handle for the NaCl MIME type. 2561 // Check each MIME type the plugins handle for the NaCl MIME type.
2562 for (mime_iter = pepper_info->mime_types.begin(); 2562 for (mime_iter = pepper_info->mime_types.begin();
2563 mime_iter != pepper_info->mime_types.end(); ++mime_iter) { 2563 mime_iter != pepper_info->mime_types.end(); ++mime_iter) {
2564 if (mime_iter->mime_type == kNaClPluginMimeType) { 2564 if (mime_iter->mime_type == kNaClPluginMimeType) {
2565 // This plugin handles "application/x-nacl". 2565 // This plugin handles "application/x-nacl".
2566 2566
2567 webkit::npapi::PluginList::Singleton()-> 2567 webkit::npapi::PluginList::Singleton()->
2568 UnregisterInternalPlugin(pepper_info->path); 2568 UnregisterInternalPlugin(pepper_info->path);
2569 2569
2570 webkit::npapi::WebPluginInfo info = pepper_info->ToWebPluginInfo(); 2570 webkit::WebPluginInfo info = pepper_info->ToWebPluginInfo();
2571 2571
2572 for (ExtensionService::NaClModuleInfoList::const_iterator iter = 2572 for (ExtensionService::NaClModuleInfoList::const_iterator iter =
2573 nacl_module_list_.begin(); 2573 nacl_module_list_.begin();
2574 iter != nacl_module_list_.end(); ++iter) { 2574 iter != nacl_module_list_.end(); ++iter) {
2575 // Add the MIME type specified in the extension to this NaCl plugin, 2575 // Add the MIME type specified in the extension to this NaCl plugin,
2576 // With an extra "nacl" argument to specify the location of the NaCl 2576 // With an extra "nacl" argument to specify the location of the NaCl
2577 // manifest file. 2577 // manifest file.
2578 webkit::npapi::WebPluginMimeType mime_type_info; 2578 webkit::WebPluginMimeType mime_type_info;
2579 mime_type_info.mime_type = iter->mime_type; 2579 mime_type_info.mime_type = iter->mime_type;
2580 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); 2580 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl"));
2581 mime_type_info.additional_param_values.push_back( 2581 mime_type_info.additional_param_values.push_back(
2582 UTF8ToUTF16(iter->url.spec())); 2582 UTF8ToUTF16(iter->url.spec()));
2583 info.mime_types.push_back(mime_type_info); 2583 info.mime_types.push_back(mime_type_info);
2584 } 2584 }
2585 2585
2586 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 2586 webkit::npapi::PluginList::Singleton()->RefreshPlugins();
2587 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); 2587 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info);
2588 // This plugin has been modified, no need to check the rest of its 2588 // This plugin has been modified, no need to check the rest of its
2589 // types, but continue checking other plugins. 2589 // types, but continue checking other plugins.
2590 break; 2590 break;
2591 } 2591 }
2592 } 2592 }
2593 } 2593 }
2594 } 2594 }
2595 2595
2596 ExtensionService::NaClModuleInfoList::iterator 2596 ExtensionService::NaClModuleInfoList::iterator
2597 ExtensionService::FindNaClModule(const GURL& url) { 2597 ExtensionService::FindNaClModule(const GURL& url) {
2598 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2598 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2599 iter != nacl_module_list_.end(); ++iter) { 2599 iter != nacl_module_list_.end(); ++iter) {
2600 if (iter->url == url) 2600 if (iter->url == url)
2601 return iter; 2601 return iter;
2602 } 2602 }
2603 return nacl_module_list_.end(); 2603 return nacl_module_list_.end();
2604 } 2604 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_content_settings_apitest.cc ('k') | chrome/browser/metrics/metrics_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698