| 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 "content/browser/plugin_service.h" | 5 #include "content/browser/plugin_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 // There should generally be very few plugins so a brute-force search is fine. | 485 // There should generally be very few plugins so a brute-force search is fine. |
| 486 PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo( | 486 PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo( |
| 487 const FilePath& plugin_path) { | 487 const FilePath& plugin_path) { |
| 488 PepperPluginInfo* info = NULL; | 488 PepperPluginInfo* info = NULL; |
| 489 for (size_t i = 0; i < ppapi_plugins_.size(); i++) { | 489 for (size_t i = 0; i < ppapi_plugins_.size(); i++) { |
| 490 if (ppapi_plugins_[i].path == plugin_path) { | 490 if (ppapi_plugins_[i].path == plugin_path) { |
| 491 info = &ppapi_plugins_[i]; | 491 info = &ppapi_plugins_[i]; |
| 492 break; | 492 break; |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 return info; | 495 if (info) |
| 496 return info; |
| 497 // We did not find the plugin in our list. But wait! the plugin can also |
| 498 // be a latecomer, as it happens with pepper flash. This information |
| 499 // can be obtained from the PluginList singleton and we can use it to |
| 500 // construct it and add it to the list. This same deal needs to be done |
| 501 // in the renderer side in PepperPluginRegistry. |
| 502 webkit::WebPluginInfo webplugin_info; |
| 503 if (!webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath( |
| 504 plugin_path, &webplugin_info)) |
| 505 return NULL; |
| 506 PepperPluginInfo new_pepper_info; |
| 507 if (!MakePepperPluginInfo(webplugin_info, &new_pepper_info)) |
| 508 return NULL; |
| 509 ppapi_plugins_.push_back(new_pepper_info); |
| 510 return &ppapi_plugins_[ppapi_plugins_.size() - 1]; |
| 496 } | 511 } |
| 497 | 512 |
| 498 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 513 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 499 // static | 514 // static |
| 500 void PluginService::RegisterFilePathWatcher( | 515 void PluginService::RegisterFilePathWatcher( |
| 501 FilePathWatcher *watcher, | 516 FilePathWatcher *watcher, |
| 502 const FilePath& path, | 517 const FilePath& path, |
| 503 FilePathWatcher::Delegate* delegate) { | 518 FilePathWatcher::Delegate* delegate) { |
| 504 bool result = watcher->Watch(path, delegate); | 519 bool result = watcher->Watch(path, delegate); |
| 505 DCHECK(result); | 520 DCHECK(result); |
| 506 } | 521 } |
| 507 #endif | 522 #endif |
| OLD | NEW |