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

Side by Side Diff: content/browser/plugin_service.cc

Issue 7990005: Use a placeholder instead of the default plugin for missing plug-ins on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 2 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 (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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // A callback for GetPlugins() that then gets the freshly loaded plugin groups 55 // A callback for GetPlugins() that then gets the freshly loaded plugin groups
56 // and runs the callback for GetPluginGroups(). 56 // and runs the callback for GetPluginGroups().
57 static void GetPluginsForGroupsCallback( 57 static void GetPluginsForGroupsCallback(
58 const PluginService::GetPluginGroupsCallback& callback, 58 const PluginService::GetPluginGroupsCallback& callback,
59 const std::vector<webkit::WebPluginInfo>& plugins) { 59 const std::vector<webkit::WebPluginInfo>& plugins) {
60 std::vector<webkit::npapi::PluginGroup> groups; 60 std::vector<webkit::npapi::PluginGroup> groups;
61 webkit::npapi::PluginList::Singleton()->GetPluginGroups(false, &groups); 61 webkit::npapi::PluginList::Singleton()->GetPluginGroups(false, &groups);
62 callback.Run(groups); 62 callback.Run(groups);
63 } 63 }
64 64
65 static void GetPluginsAndIgnoreCallback(
66 const base::Closure& callback,
67 const std::vector<webkit::WebPluginInfo>& plugins) {
68 callback.Run();
69 }
70
65 // Callback set on the PluginList to assert that plugin loading happens on the 71 // Callback set on the PluginList to assert that plugin loading happens on the
66 // correct thread. 72 // correct thread.
67 void WillLoadPluginsCallback() { 73 void WillLoadPluginsCallback() {
68 // TODO(rsesek): Change these to CHECKs. 74 // TODO(rsesek): Change these to CHECKs.
69 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) 75 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
70 LOG_IF(ERROR, !BrowserThread::CurrentlyOn(BrowserThread::FILE)); 76 LOG_IF(ERROR, !BrowserThread::CurrentlyOn(BrowserThread::FILE));
71 #else 77 #else
72 LOG(ERROR) << "Plugin loading should happen out-of-process."; 78 LOG(ERROR) << "Plugin loading should happen out-of-process.";
73 #endif 79 #endif
74 } 80 }
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 481
476 PluginProcessHost* plugin_host = FindOrStartNpapiPluginProcess(plugin_path); 482 PluginProcessHost* plugin_host = FindOrStartNpapiPluginProcess(plugin_path);
477 if (plugin_host) { 483 if (plugin_host) {
478 client->OnFoundPluginProcessHost(plugin_host); 484 client->OnFoundPluginProcessHost(plugin_host);
479 plugin_host->OpenChannelToPlugin(client); 485 plugin_host->OpenChannelToPlugin(client);
480 } else { 486 } else {
481 client->OnError(); 487 client->OnError();
482 } 488 }
483 } 489 }
484 490
491 bool PluginService::GetPluginInfoArray(
492 const GURL& url,
493 const std::string& mime_type,
494 bool allow_wildcard,
495 std::vector<webkit::WebPluginInfo>* plugins,
496 std::vector<std::string>* actual_mime_types) {
497 bool use_stale = false;
498 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray(
499 url, mime_type, allow_wildcard, &use_stale, plugins, actual_mime_types);
500 return use_stale;
501 }
502
485 bool PluginService::GetPluginInfo(int render_process_id, 503 bool PluginService::GetPluginInfo(int render_process_id,
486 int render_view_id, 504 int render_view_id,
487 const content::ResourceContext& context, 505 const content::ResourceContext& context,
488 const GURL& url, 506 const GURL& url,
489 const GURL& page_url, 507 const GURL& page_url,
490 const std::string& mime_type, 508 const std::string& mime_type,
491 bool allow_wildcard, 509 bool allow_wildcard,
492 bool* use_stale, 510 bool* use_stale,
493 webkit::WebPluginInfo* info, 511 webkit::WebPluginInfo* info,
494 std::string* actual_mime_type) { 512 std::string* actual_mime_type) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 const PluginService::GetPluginsCallback& callback) { 579 const PluginService::GetPluginsCallback& callback) {
562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 580 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
563 581
564 std::vector<webkit::WebPluginInfo> plugins; 582 std::vector<webkit::WebPluginInfo> plugins;
565 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins); 583 webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins);
566 584
567 target_loop->PostTask(FROM_HERE, 585 target_loop->PostTask(FROM_HERE,
568 base::Bind(&RunGetPluginsCallback, callback, plugins)); 586 base::Bind(&RunGetPluginsCallback, callback, plugins));
569 } 587 }
570 588
589 void PluginService::EnsurePluginsLoaded(const base::Closure& callback) {
590 GetPlugins(base::Bind(&GetPluginsAndIgnoreCallback, callback));
591 }
592
571 void PluginService::OnWaitableEventSignaled( 593 void PluginService::OnWaitableEventSignaled(
572 base::WaitableEvent* waitable_event) { 594 base::WaitableEvent* waitable_event) {
573 #if defined(OS_WIN) 595 #if defined(OS_WIN)
574 if (waitable_event == hkcu_event_.get()) { 596 if (waitable_event == hkcu_event_.get()) {
575 hkcu_key_.StartWatching(); 597 hkcu_key_.StartWatching();
576 } else { 598 } else {
577 hklm_key_.StartWatching(); 599 hklm_key_.StartWatching();
578 } 600 }
579 601
580 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 602 webkit::npapi::PluginList::Singleton()->RefreshPlugins();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 #if defined(OS_POSIX) && !defined(OS_MACOSX) 667 #if defined(OS_POSIX) && !defined(OS_MACOSX)
646 // static 668 // static
647 void PluginService::RegisterFilePathWatcher( 669 void PluginService::RegisterFilePathWatcher(
648 FilePathWatcher *watcher, 670 FilePathWatcher *watcher,
649 const FilePath& path, 671 const FilePath& path,
650 FilePathWatcher::Delegate* delegate) { 672 FilePathWatcher::Delegate* delegate) {
651 bool result = watcher->Watch(path, delegate); 673 bool result = watcher->Watch(path, delegate);
652 DCHECK(result); 674 DCHECK(result);
653 } 675 }
654 #endif 676 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698