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/threading/thread.h" | 13 #include "base/threading/thread.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/chrome_plugin_host.h" | 18 #include "chrome/browser/chrome_plugin_host.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/plugin_updater.h" | 20 #include "chrome/browser/plugin_updater.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 static void PurgePluginListCache(bool reload_pages) { | 57 static void PurgePluginListCache(bool reload_pages) { |
57 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); | 58 for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); |
58 !it.IsAtEnd(); it.Advance()) { | 59 !it.IsAtEnd(); it.Advance()) { |
59 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); | 60 it.GetCurrentValue()->Send(new ViewMsg_PurgePluginListCache(reload_pages)); |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
63 #if defined(OS_LINUX) | 64 #if defined(OS_LINUX) |
64 // Delegate class for monitoring directories. | 65 // Delegate class for monitoring directories. |
65 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { | 66 class PluginDirWatcherDelegate : public FilePathWatcher::Delegate { |
66 virtual void OnFilePathChanged(const FilePath& path) { | 67 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE { |
67 VLOG(1) << "Watched path changed: " << path.value(); | 68 VLOG(1) << "Watched path changed: " << path.value(); |
68 // Make the plugin list update itself | 69 // Make the plugin list update itself |
69 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 70 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
70 } | 71 } |
71 virtual void OnError() { | 72 virtual void OnFilePathError(const FilePath& path) OVERRIDE { |
72 // TODO(pastarmovj): Add some sensible error handling. Maybe silently | 73 // TODO(pastarmovj): Add some sensible error handling. Maybe silently |
73 // stopping the watcher would be enough. Or possibly restart it. | 74 // stopping the watcher would be enough. Or possibly restart it. |
74 NOTREACHED(); | 75 NOTREACHED(); |
75 } | 76 } |
76 }; | 77 }; |
77 #endif | 78 #endif |
78 | 79 |
79 // static | 80 // static |
80 bool PluginService::enable_chrome_plugins_ = true; | 81 bool PluginService::enable_chrome_plugins_ = true; |
81 | 82 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 #if defined(OS_LINUX) | 580 #if defined(OS_LINUX) |
580 // static | 581 // static |
581 void PluginService::RegisterFilePathWatcher( | 582 void PluginService::RegisterFilePathWatcher( |
582 FilePathWatcher *watcher, | 583 FilePathWatcher *watcher, |
583 const FilePath& path, | 584 const FilePath& path, |
584 FilePathWatcher::Delegate* delegate) { | 585 FilePathWatcher::Delegate* delegate) { |
585 bool result = watcher->Watch(path, delegate); | 586 bool result = watcher->Watch(path, delegate); |
586 DCHECK(result); | 587 DCHECK(result); |
587 } | 588 } |
588 #endif | 589 #endif |
OLD | NEW |