OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/plugin_service_impl.h" | 5 #include "content/browser/plugin_service_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 void PluginServiceImpl::RegisterPepperPlugins() { | 327 void PluginServiceImpl::RegisterPepperPlugins() { |
328 ComputePepperPluginList(&ppapi_plugins_); | 328 ComputePepperPluginList(&ppapi_plugins_); |
329 for (size_t i = 0; i < ppapi_plugins_.size(); ++i) { | 329 for (size_t i = 0; i < ppapi_plugins_.size(); ++i) { |
330 RegisterInternalPlugin(ppapi_plugins_[i].ToWebPluginInfo(), true); | 330 RegisterInternalPlugin(ppapi_plugins_[i].ToWebPluginInfo(), true); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 // There should generally be very few plugins so a brute-force search is fine. | 334 // There should generally be very few plugins so a brute-force search is fine. |
335 PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( | 335 PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( |
336 const base::FilePath& plugin_path) { | 336 const base::FilePath& plugin_path) { |
337 PepperPluginInfo* info = NULL; | |
338 for (size_t i = 0; i < ppapi_plugins_.size(); ++i) { | 337 for (size_t i = 0; i < ppapi_plugins_.size(); ++i) { |
339 if (ppapi_plugins_[i].path == plugin_path) { | 338 if (ppapi_plugins_[i].path == plugin_path) |
340 info = &ppapi_plugins_[i]; | 339 return &ppapi_plugins_[i]; |
341 break; | |
342 } | |
343 } | 340 } |
344 if (info) | |
345 return info; | |
346 // We did not find the plugin in our list. But wait! the plugin can also | 341 // We did not find the plugin in our list. But wait! the plugin can also |
347 // be a latecomer, as it happens with pepper flash. This information | 342 // be a latecomer, as it happens with pepper flash. This information |
348 // can be obtained from the PluginList singleton and we can use it to | 343 // can be obtained from the PluginList singleton and we can use it to |
349 // construct it and add it to the list. This same deal needs to be done | 344 // construct it and add it to the list. This same deal needs to be done |
350 // in the renderer side in PepperPluginRegistry. | 345 // in the renderer side in PepperPluginRegistry. |
351 WebPluginInfo webplugin_info; | 346 WebPluginInfo webplugin_info; |
352 if (!GetPluginInfoByPath(plugin_path, &webplugin_info)) | 347 if (!GetPluginInfoByPath(plugin_path, &webplugin_info)) |
353 return NULL; | 348 return nullptr; |
354 PepperPluginInfo new_pepper_info; | 349 PepperPluginInfo new_pepper_info; |
355 if (!MakePepperPluginInfo(webplugin_info, &new_pepper_info)) | 350 if (!MakePepperPluginInfo(webplugin_info, &new_pepper_info)) |
356 return NULL; | 351 return nullptr; |
357 ppapi_plugins_.push_back(new_pepper_info); | 352 ppapi_plugins_.push_back(new_pepper_info); |
358 return &ppapi_plugins_[ppapi_plugins_.size() - 1]; | 353 return &ppapi_plugins_.back(); |
359 } | 354 } |
360 | 355 |
361 void PluginServiceImpl::SetFilter(PluginServiceFilter* filter) { | 356 void PluginServiceImpl::SetFilter(PluginServiceFilter* filter) { |
362 filter_ = filter; | 357 filter_ = filter; |
363 } | 358 } |
364 | 359 |
365 PluginServiceFilter* PluginServiceImpl::GetFilter() { | 360 PluginServiceFilter* PluginServiceImpl::GetFilter() { |
366 return filter_; | 361 return filter_; |
367 } | 362 } |
368 | 363 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } | 413 } |
419 | 414 |
420 bool PluginServiceImpl::PpapiDevChannelSupported( | 415 bool PluginServiceImpl::PpapiDevChannelSupported( |
421 BrowserContext* browser_context, | 416 BrowserContext* browser_context, |
422 const GURL& document_url) { | 417 const GURL& document_url) { |
423 return GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( | 418 return GetContentClient()->browser()->IsPluginAllowedToUseDevChannelAPIs( |
424 browser_context, document_url); | 419 browser_context, document_url); |
425 } | 420 } |
426 | 421 |
427 } // namespace content | 422 } // namespace content |
OLD | NEW |