| 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 // TODO(rsesek): Change these to CHECKs. | 69 #if defined(OS_WIN) |
| 70 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) | |
| 71 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 70 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 72 #else | 71 #else |
| 73 CHECK(false) << "Plugin loading should happen out-of-process."; | 72 CHECK(false) << "Plugin loading should happen out-of-process."; |
| 74 #endif | 73 #endif |
| 75 } | 74 } |
| 76 | 75 |
| 77 } // namespace | 76 } // namespace |
| 78 | 77 |
| 79 #if defined(OS_MACOSX) | 78 #if defined(OS_MACOSX) |
| 80 static void NotifyPluginsOfActivation() { | 79 static void NotifyPluginsOfActivation() { |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 488 } |
| 490 | 489 |
| 491 void PluginService::RefreshPluginList() { | 490 void PluginService::RefreshPluginList() { |
| 492 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 491 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 493 } | 492 } |
| 494 | 493 |
| 495 void PluginService::GetPlugins(const GetPluginsCallback& callback) { | 494 void PluginService::GetPlugins(const GetPluginsCallback& callback) { |
| 496 scoped_refptr<base::MessageLoopProxy> target_loop( | 495 scoped_refptr<base::MessageLoopProxy> target_loop( |
| 497 MessageLoop::current()->message_loop_proxy()); | 496 MessageLoop::current()->message_loop_proxy()); |
| 498 | 497 |
| 499 #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) | 498 #if defined(OS_WIN) |
| 500 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 499 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 501 base::Bind(&PluginService::GetPluginsInternal, base::Unretained(this), | 500 base::Bind(&PluginService::GetPluginsInternal, base::Unretained(this), |
| 502 target_loop, callback)); | 501 target_loop, callback)); |
| 503 #else | 502 #else |
| 504 std::vector<webkit::WebPluginInfo> cached_plugins; | 503 std::vector<webkit::WebPluginInfo> cached_plugins; |
| 505 if (webkit::npapi::PluginList::Singleton()->GetPluginsIfNoRefreshNeeded( | 504 if (webkit::npapi::PluginList::Singleton()->GetPluginsIfNoRefreshNeeded( |
| 506 &cached_plugins)) { | 505 &cached_plugins)) { |
| 507 // Can't assume the caller is reentrant. | 506 // Can't assume the caller is reentrant. |
| 508 target_loop->PostTask(FROM_HERE, | 507 target_loop->PostTask(FROM_HERE, |
| 509 base::Bind(&RunGetPluginsCallback, callback, cached_plugins)); | 508 base::Bind(&RunGetPluginsCallback, callback, cached_plugins)); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 612 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 614 // static | 613 // static |
| 615 void PluginService::RegisterFilePathWatcher( | 614 void PluginService::RegisterFilePathWatcher( |
| 616 FilePathWatcher *watcher, | 615 FilePathWatcher *watcher, |
| 617 const FilePath& path, | 616 const FilePath& path, |
| 618 FilePathWatcher::Delegate* delegate) { | 617 FilePathWatcher::Delegate* delegate) { |
| 619 bool result = watcher->Watch(path, delegate); | 618 bool result = watcher->Watch(path, delegate); |
| 620 DCHECK(result); | 619 DCHECK(result); |
| 621 } | 620 } |
| 622 #endif | 621 #endif |
| OLD | NEW |