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 "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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const PluginService::GetPluginGroupsCallback& callback, | 59 const PluginService::GetPluginGroupsCallback& callback, |
60 const std::vector<webkit::WebPluginInfo>& plugins) { | 60 const std::vector<webkit::WebPluginInfo>& plugins) { |
61 std::vector<webkit::npapi::PluginGroup> groups; | 61 std::vector<webkit::npapi::PluginGroup> groups; |
62 webkit::npapi::PluginList::Singleton()->GetPluginGroups(false, &groups); | 62 webkit::npapi::PluginList::Singleton()->GetPluginGroups(false, &groups); |
63 callback.Run(groups); | 63 callback.Run(groups); |
64 } | 64 } |
65 | 65 |
66 // Callback set on the PluginList to assert that plugin loading happens on the | 66 // Callback set on the PluginList to assert that plugin loading happens on the |
67 // correct thread. | 67 // correct thread. |
68 void WillLoadPluginsCallback() { | 68 void WillLoadPluginsCallback() { |
69 #if defined(OS_WIN) | 69 // TODO(rsesek): Change these to CHECKs. |
| 70 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) |
70 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 71 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
71 #else | 72 #else |
72 CHECK(false) << "Plugin loading should happen out-of-process."; | 73 CHECK(false) << "Plugin loading should happen out-of-process."; |
73 #endif | 74 #endif |
74 } | 75 } |
75 | 76 |
76 } // namespace | 77 } // namespace |
77 | 78 |
78 #if defined(OS_MACOSX) | 79 #if defined(OS_MACOSX) |
79 static void NotifyPluginsOfActivation() { | 80 static void NotifyPluginsOfActivation() { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 492 } |
492 | 493 |
493 void PluginService::RefreshPluginList() { | 494 void PluginService::RefreshPluginList() { |
494 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 495 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
495 } | 496 } |
496 | 497 |
497 void PluginService::GetPlugins(const GetPluginsCallback& callback) { | 498 void PluginService::GetPlugins(const GetPluginsCallback& callback) { |
498 scoped_refptr<base::MessageLoopProxy> target_loop( | 499 scoped_refptr<base::MessageLoopProxy> target_loop( |
499 MessageLoop::current()->message_loop_proxy()); | 500 MessageLoop::current()->message_loop_proxy()); |
500 | 501 |
501 #if defined(OS_WIN) | 502 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) |
502 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 503 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
503 base::Bind(&PluginService::GetPluginsInternal, base::Unretained(this), | 504 base::Bind(&PluginService::GetPluginsInternal, base::Unretained(this), |
504 target_loop, callback)); | 505 target_loop, callback)); |
505 #else | 506 #else |
506 std::vector<webkit::WebPluginInfo> cached_plugins; | 507 std::vector<webkit::WebPluginInfo> cached_plugins; |
507 if (webkit::npapi::PluginList::Singleton()->GetPluginsIfNoRefreshNeeded( | 508 if (webkit::npapi::PluginList::Singleton()->GetPluginsIfNoRefreshNeeded( |
508 &cached_plugins)) { | 509 &cached_plugins)) { |
509 // Can't assume the caller is reentrant. | 510 // Can't assume the caller is reentrant. |
510 target_loop->PostTask(FROM_HERE, | 511 target_loop->PostTask(FROM_HERE, |
511 base::Bind(&RunGetPluginsCallback, callback, cached_plugins)); | 512 base::Bind(&RunGetPluginsCallback, callback, cached_plugins)); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 616 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
616 // static | 617 // static |
617 void PluginService::RegisterFilePathWatcher( | 618 void PluginService::RegisterFilePathWatcher( |
618 FilePathWatcher *watcher, | 619 FilePathWatcher *watcher, |
619 const FilePath& path, | 620 const FilePath& path, |
620 FilePathWatcher::Delegate* delegate) { | 621 FilePathWatcher::Delegate* delegate) { |
621 bool result = watcher->Watch(path, delegate); | 622 bool result = watcher->Watch(path, delegate); |
622 DCHECK(result); | 623 DCHECK(result); |
623 } | 624 } |
624 #endif | 625 #endif |
OLD | NEW |