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> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
13 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/plugin_updater.h" | 19 #include "chrome/browser/plugin_updater.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 static void PurgePluginListCache(bool reload_pages) { | 55 static void PurgePluginListCache(bool reload_pages) { |
55 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); | 56 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); |
56 !it.IsAtEnd(); it.Advance()) { | 57 !it.IsAtEnd(); it.Advance()) { |
57 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); | 58 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); |
58 } | 59 } |
59 } | 60 } |
60 | 61 |
61 #if defined(OS_LINUX) | 62 #if defined(OS_LINUX) |
62 // Delegate class for monitoring directories. | 63 // Delegate class for monitoring directories. |
63 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { | 64 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { |
64 virtual void OnFilePathChanged(const FilePath& path) { | 65 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE { |
65 VLOG(1) << "Watched path changed: " << path.value(); | 66 VLOG(1) << "Watched path changed: " << path.value(); |
66 // Make the plugin list update itself | 67 // Make the plugin list update itself |
67 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 68 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
68 } | 69 } |
69 virtual void OnError() { | 70 virtual void OnFilePathError(const FilePath& path) OVERRIDE { |
70 // TODO(pastarmovj): Add some sensible error handling. Maybe silently | 71 // TODO(pastarmovj): Add some sensible error handling. Maybe silently |
71 // stopping the watcher would be enough. Or possibly restart it. | 72 // stopping the watcher would be enough. Or possibly restart it. |
72 NOTREACHED(); | 73 NOTREACHED(); |
73 } | 74 } |
74 }; | 75 }; |
75 #endif | 76 #endif |
76 | 77 |
77 // static | 78 // static |
78 void PluginService::InitGlobalInstance(Profile* profile) { | 79 void PluginService::InitGlobalInstance(Profile* profile) { |
79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); | 543 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); |
543 } | 544 } |
544 } | 545 } |
545 | 546 |
546 #if defined(OS_LINUX) | 547 #if defined(OS_LINUX) |
547 // static | 548 // static |
548 void PluginService::RegisterFilePathWatcher( | 549 void PluginService::RegisterFilePathWatcher( |
549 FilePathWatcher *watcher, | 550 FilePathWatcher *watcher, |
550 const FilePath& path, | 551 const FilePath& path, |
551 FilePathWatcher::Delegate* delegate) { | 552 FilePathWatcher::Delegate* delegate) { |
552 bool result = watcher->Watch( | 553 bool result = watcher->Watch(path, delegate); |
553 path, delegate, base::MessageLoopProxy::CreateForCurrentThread()); | |
554 DCHECK(result); | 554 DCHECK(result); |
555 } | 555 } |
556 #endif | 556 #endif |
OLD | NEW |