OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/plugin_service.h" | 5 #include "chrome/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/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 info_array); | 359 info_array); |
360 if (!info_array.empty() && allowed_index >= 0) { | 360 if (!info_array.empty() && allowed_index >= 0) { |
361 *info = info_array[allowed_index]; | 361 *info = info_array[allowed_index]; |
362 if (actual_mime_type) | 362 if (actual_mime_type) |
363 *actual_mime_type = actual_mime_types[allowed_index]; | 363 *actual_mime_type = actual_mime_types[allowed_index]; |
364 return true; | 364 return true; |
365 } | 365 } |
366 return false; | 366 return false; |
367 #else | 367 #else |
368 { | 368 { |
369 AutoLock auto_lock(overridden_plugins_lock_); | 369 base::AutoLock auto_lock(overridden_plugins_lock_); |
370 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { | 370 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { |
371 if (overridden_plugins_[i].render_process_id == render_process_id && | 371 if (overridden_plugins_[i].render_process_id == render_process_id && |
372 overridden_plugins_[i].render_view_id == render_view_id && | 372 overridden_plugins_[i].render_view_id == render_view_id && |
373 overridden_plugins_[i].url == url) { | 373 overridden_plugins_[i].url == url) { |
374 *actual_mime_type = mime_type; | 374 *actual_mime_type = mime_type; |
375 *info = overridden_plugins_[i].plugin; | 375 *info = overridden_plugins_[i].plugin; |
376 return true; | 376 return true; |
377 } | 377 } |
378 } | 378 } |
379 } | 379 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 } | 455 } |
456 #endif | 456 #endif |
457 | 457 |
458 case NotificationType::PLUGIN_ENABLE_STATUS_CHANGED: { | 458 case NotificationType::PLUGIN_ENABLE_STATUS_CHANGED: { |
459 PurgePluginListCache(false); | 459 PurgePluginListCache(false); |
460 break; | 460 break; |
461 } | 461 } |
462 case NotificationType::RENDERER_PROCESS_CLOSED: { | 462 case NotificationType::RENDERER_PROCESS_CLOSED: { |
463 int render_process_id = Source<RenderProcessHost>(source).ptr()->id(); | 463 int render_process_id = Source<RenderProcessHost>(source).ptr()->id(); |
464 | 464 |
465 AutoLock auto_lock(overridden_plugins_lock_); | 465 base::AutoLock auto_lock(overridden_plugins_lock_); |
466 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { | 466 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { |
467 if (overridden_plugins_[i].render_process_id == render_process_id) { | 467 if (overridden_plugins_[i].render_process_id == render_process_id) { |
468 overridden_plugins_.erase(overridden_plugins_.begin() + i); | 468 overridden_plugins_.erase(overridden_plugins_.begin() + i); |
469 break; | 469 break; |
470 } | 470 } |
471 } | 471 } |
472 break; | 472 break; |
473 } | 473 } |
474 default: | 474 default: |
475 NOTREACHED(); | 475 NOTREACHED(); |
(...skipping 10 matching lines...) Expand all Loading... |
486 return true; // This plugin is not private, so it's allowed everywhere. | 486 return true; // This plugin is not private, so it's allowed everywhere. |
487 | 487 |
488 // We do a dumb compare of scheme and host, rather than using the domain | 488 // We do a dumb compare of scheme and host, rather than using the domain |
489 // service, since we only care about this for extensions. | 489 // service, since we only care about this for extensions. |
490 const GURL& required_url = it->second; | 490 const GURL& required_url = it->second; |
491 return (url.scheme() == required_url.scheme() && | 491 return (url.scheme() == required_url.scheme() && |
492 url.host() == required_url.host()); | 492 url.host() == required_url.host()); |
493 } | 493 } |
494 | 494 |
495 void PluginService::OverridePluginForTab(OverriddenPlugin plugin) { | 495 void PluginService::OverridePluginForTab(OverriddenPlugin plugin) { |
496 AutoLock auto_lock(overridden_plugins_lock_); | 496 base::AutoLock auto_lock(overridden_plugins_lock_); |
497 overridden_plugins_.push_back(plugin); | 497 overridden_plugins_.push_back(plugin); |
498 } | 498 } |
499 | 499 |
500 void PluginService::RegisterPepperPlugins() { | 500 void PluginService::RegisterPepperPlugins() { |
501 std::vector<PepperPluginInfo> plugins; | 501 std::vector<PepperPluginInfo> plugins; |
502 PepperPluginRegistry::GetList(&plugins); | 502 PepperPluginRegistry::GetList(&plugins); |
503 for (size_t i = 0; i < plugins.size(); ++i) { | 503 for (size_t i = 0; i < plugins.size(); ++i) { |
504 webkit::npapi::WebPluginInfo info; | 504 webkit::npapi::WebPluginInfo info; |
505 info.path = plugins[i].path; | 505 info.path = plugins[i].path; |
506 info.name = plugins[i].name.empty() ? | 506 info.name = plugins[i].name.empty() ? |
(...skipping 21 matching lines...) Expand all Loading... |
528 #if defined(OS_LINUX) | 528 #if defined(OS_LINUX) |
529 // static | 529 // static |
530 void PluginService::RegisterFilePathWatcher( | 530 void PluginService::RegisterFilePathWatcher( |
531 FilePathWatcher *watcher, | 531 FilePathWatcher *watcher, |
532 const FilePath& path, | 532 const FilePath& path, |
533 FilePathWatcher::Delegate* delegate) { | 533 FilePathWatcher::Delegate* delegate) { |
534 bool result = watcher->Watch(path, delegate); | 534 bool result = watcher->Watch(path, delegate); |
535 DCHECK(result); | 535 DCHECK(result); |
536 } | 536 } |
537 #endif | 537 #endif |
OLD | NEW |