| 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> | |
| 8 | |
| 9 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 11 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 13 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 15 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 14 #include "base/values.h" |
| 17 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
| 18 #include "content/browser/content_browser_client.h" | 16 #include "content/browser/content_browser_client.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 webkit::WebPluginInfo* info, | 351 webkit::WebPluginInfo* info, |
| 354 std::string* actual_mime_type) { | 352 std::string* actual_mime_type) { |
| 355 // GetPluginInfoArray may need to load the plugins, so we need to be | 353 // GetPluginInfoArray may need to load the plugins, so we need to be |
| 356 // on the FILE thread. | 354 // on the FILE thread. |
| 357 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 355 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 358 { | 356 { |
| 359 base::AutoLock auto_lock(overridden_plugins_lock_); | 357 base::AutoLock auto_lock(overridden_plugins_lock_); |
| 360 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { | 358 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { |
| 361 if (overridden_plugins_[i].render_process_id == render_process_id && | 359 if (overridden_plugins_[i].render_process_id == render_process_id && |
| 362 overridden_plugins_[i].render_view_id == render_view_id && | 360 overridden_plugins_[i].render_view_id == render_view_id && |
| 363 overridden_plugins_[i].url == url) { | 361 (overridden_plugins_[i].url == url || |
| 362 overridden_plugins_[i].url.is_empty())) { |
| 364 if (actual_mime_type) | 363 if (actual_mime_type) |
| 365 *actual_mime_type = mime_type; | 364 *actual_mime_type = mime_type; |
| 366 *info = overridden_plugins_[i].plugin; | 365 *info = overridden_plugins_[i].plugin; |
| 367 return true; | 366 return true; |
| 368 } | 367 } |
| 369 } | 368 } |
| 370 } | 369 } |
| 371 bool allow_wildcard = true; | 370 bool allow_wildcard = true; |
| 372 std::vector<webkit::WebPluginInfo> plugins; | 371 std::vector<webkit::WebPluginInfo> plugins; |
| 373 std::vector<std::string> mime_types; | 372 std::vector<std::string> mime_types; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( | 479 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( |
| 481 ppapi_plugins_[i].ToWebPluginInfo()); | 480 ppapi_plugins_[i].ToWebPluginInfo()); |
| 482 } | 481 } |
| 483 } | 482 } |
| 484 | 483 |
| 485 // There should generally be very few plugins so a brute-force search is fine. | 484 // There should generally be very few plugins so a brute-force search is fine. |
| 486 PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo( | 485 PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo( |
| 487 const FilePath& plugin_path) { | 486 const FilePath& plugin_path) { |
| 488 PepperPluginInfo* info = NULL; | 487 PepperPluginInfo* info = NULL; |
| 489 for (size_t i = 0; i < ppapi_plugins_.size(); i++) { | 488 for (size_t i = 0; i < ppapi_plugins_.size(); i++) { |
| 490 if (ppapi_plugins_[i].path == plugin_path) { | 489 if (ppapi_plugins_[i].path == plugin_path) { |
| 491 info = &ppapi_plugins_[i]; | 490 info = &ppapi_plugins_[i]; |
| 492 break; | 491 break; |
| 493 } | 492 } |
| 494 } | 493 } |
| 495 return info; | 494 return info; |
| 496 } | 495 } |
| 497 | 496 |
| 498 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 497 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 499 // static | 498 // static |
| 500 void PluginService::RegisterFilePathWatcher( | 499 void PluginService::RegisterFilePathWatcher( |
| 501 FilePathWatcher *watcher, | 500 FilePathWatcher *watcher, |
| 502 const FilePath& path, | 501 const FilePath& path, |
| 503 FilePathWatcher::Delegate* delegate) { | 502 FilePathWatcher::Delegate* delegate) { |
| 504 bool result = watcher->Watch(path, delegate); | 503 bool result = watcher->Watch(path, delegate); |
| 505 DCHECK(result); | 504 DCHECK(result); |
| 506 } | 505 } |
| 507 #endif | 506 #endif |
| OLD | NEW |