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

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

Issue 19894003: Move webplugininfo.h to content/public. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/lazy_instance.h" 6 #include "base/lazy_instance.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/plugin_manager.h" 10 #include "chrome/browser/extensions/plugin_manager.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // MIME type to plugins which handle NaCl modules in order to allow the 141 // MIME type to plugins which handle NaCl modules in order to allow the
142 // individual modules to handle these types. 142 // individual modules to handle these types.
143 base::FilePath path; 143 base::FilePath path;
144 if (!PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) 144 if (!PathService::Get(chrome::FILE_NACL_PLUGIN, &path))
145 return; 145 return;
146 const content::PepperPluginInfo* pepper_info = 146 const content::PepperPluginInfo* pepper_info =
147 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(path); 147 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(path);
148 if (!pepper_info) 148 if (!pepper_info)
149 return; 149 return;
150 150
151 std::vector<webkit::WebPluginMimeType>::const_iterator mime_iter; 151 std::vector<content::WebPluginMimeType>::const_iterator mime_iter;
152 // Check each MIME type the plugins handle for the NaCl MIME type. 152 // Check each MIME type the plugins handle for the NaCl MIME type.
153 for (mime_iter = pepper_info->mime_types.begin(); 153 for (mime_iter = pepper_info->mime_types.begin();
154 mime_iter != pepper_info->mime_types.end(); ++mime_iter) { 154 mime_iter != pepper_info->mime_types.end(); ++mime_iter) {
155 if (mime_iter->mime_type == kNaClPluginMimeType) { 155 if (mime_iter->mime_type == kNaClPluginMimeType) {
156 // This plugin handles "application/x-nacl". 156 // This plugin handles "application/x-nacl".
157 157
158 PluginService::GetInstance()->UnregisterInternalPlugin(pepper_info->path); 158 PluginService::GetInstance()->UnregisterInternalPlugin(pepper_info->path);
159 159
160 webkit::WebPluginInfo info = pepper_info->ToWebPluginInfo(); 160 content::WebPluginInfo info = pepper_info->ToWebPluginInfo();
161 161
162 for (NaClModuleInfo::List::const_iterator iter = 162 for (NaClModuleInfo::List::const_iterator iter =
163 nacl_module_list_.begin(); 163 nacl_module_list_.begin();
164 iter != nacl_module_list_.end(); ++iter) { 164 iter != nacl_module_list_.end(); ++iter) {
165 // Add the MIME type specified in the extension to this NaCl plugin, 165 // Add the MIME type specified in the extension to this NaCl plugin,
166 // With an extra "nacl" argument to specify the location of the NaCl 166 // With an extra "nacl" argument to specify the location of the NaCl
167 // manifest file. 167 // manifest file.
168 webkit::WebPluginMimeType mime_type_info; 168 content::WebPluginMimeType mime_type_info;
169 mime_type_info.mime_type = iter->mime_type; 169 mime_type_info.mime_type = iter->mime_type;
170 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); 170 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl"));
171 mime_type_info.additional_param_values.push_back( 171 mime_type_info.additional_param_values.push_back(
172 UTF8ToUTF16(iter->url.spec())); 172 UTF8ToUTF16(iter->url.spec()));
173 info.mime_types.push_back(mime_type_info); 173 info.mime_types.push_back(mime_type_info);
174 } 174 }
175 175
176 PluginService::GetInstance()->RefreshPlugins(); 176 PluginService::GetInstance()->RefreshPlugins();
177 PluginService::GetInstance()->RegisterInternalPlugin(info, true); 177 PluginService::GetInstance()->RegisterInternalPlugin(info, true);
178 // This plugin has been modified, no need to check the rest of its 178 // This plugin has been modified, no need to check the rest of its
179 // types, but continue checking other plugins. 179 // types, but continue checking other plugins.
180 break; 180 break;
181 } 181 }
182 } 182 }
183 } 183 }
184 184
185 NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) { 185 NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) {
186 for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin(); 186 for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin();
187 iter != nacl_module_list_.end(); ++iter) { 187 iter != nacl_module_list_.end(); ++iter) {
188 if (iter->url == url) 188 if (iter->url == url)
189 return iter; 189 return iter;
190 } 190 }
191 return nacl_module_list_.end(); 191 return nacl_module_list_.end();
192 } 192 }
193 193
194 } // namespace extensions 194 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698