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/compiler_specific.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "content/common/notification_type.h" | 31 #include "content/common/notification_type.h" |
32 #include "content/common/plugin_messages.h" | 32 #include "content/common/plugin_messages.h" |
33 #include "webkit/plugins/npapi/plugin_constants_win.h" | 33 #include "webkit/plugins/npapi/plugin_constants_win.h" |
34 #include "webkit/plugins/npapi/plugin_list.h" | 34 #include "webkit/plugins/npapi/plugin_list.h" |
35 #include "webkit/plugins/npapi/webplugininfo.h" | 35 #include "webkit/plugins/npapi/webplugininfo.h" |
36 | 36 |
37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
38 #include "chrome/browser/chromeos/plugin_selection_policy.h" | 38 #include "chrome/browser/chromeos/plugin_selection_policy.h" |
39 #endif | 39 #endif |
40 | 40 |
| 41 #if defined(OS_LINUX) |
| 42 using ::base::files::FilePathWatcher; |
| 43 #endif |
| 44 |
41 #if defined(OS_MACOSX) | 45 #if defined(OS_MACOSX) |
42 static void NotifyPluginsOfActivation() { | 46 static void NotifyPluginsOfActivation() { |
43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
44 | 48 |
45 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); | 49 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS); |
46 !iter.Done(); ++iter) { | 50 !iter.Done(); ++iter) { |
47 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); | 51 PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); |
48 plugin->OnAppActivation(); | 52 plugin->OnAppActivation(); |
49 } | 53 } |
50 } | 54 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // important plugins register themselves in the registry so no need to do that. | 144 // important plugins register themselves in the registry so no need to do that. |
141 #if defined(OS_LINUX) | 145 #if defined(OS_LINUX) |
142 file_watcher_delegate_ = new PluginDirWatcherDelegate(); | 146 file_watcher_delegate_ = new PluginDirWatcherDelegate(); |
143 // Get the list of all paths for registering the FilePathWatchers | 147 // Get the list of all paths for registering the FilePathWatchers |
144 // that will track and if needed reload the list of plugins on runtime. | 148 // that will track and if needed reload the list of plugins on runtime. |
145 std::vector<FilePath> plugin_dirs; | 149 std::vector<FilePath> plugin_dirs; |
146 webkit::npapi::PluginList::Singleton()->GetPluginDirectories( | 150 webkit::npapi::PluginList::Singleton()->GetPluginDirectories( |
147 &plugin_dirs); | 151 &plugin_dirs); |
148 | 152 |
149 for (size_t i = 0; i < plugin_dirs.size(); ++i) { | 153 for (size_t i = 0; i < plugin_dirs.size(); ++i) { |
150 FilePathWatcher* watcher = new FilePathWatcher(); | |
151 // FilePathWatcher can not handle non-absolute paths under windows. | 154 // FilePathWatcher can not handle non-absolute paths under windows. |
152 // We don't watch for file changes in windows now but if this should ever | 155 // We don't watch for file changes in windows now but if this should ever |
153 // be extended to Windows these lines might save some time of debugging. | 156 // be extended to Windows these lines might save some time of debugging. |
154 #if defined(OS_WIN) | 157 #if defined(OS_WIN) |
155 if (!plugin_dirs[i].IsAbsolute()) | 158 if (!plugin_dirs[i].IsAbsolute()) |
156 continue; | 159 continue; |
157 #endif | 160 #endif |
| 161 FilePathWatcher* watcher = new FilePathWatcher(); |
158 VLOG(1) << "Watching for changes in: " << plugin_dirs[i].value(); | 162 VLOG(1) << "Watching for changes in: " << plugin_dirs[i].value(); |
159 BrowserThread::PostTask( | 163 BrowserThread::PostTask( |
160 BrowserThread::FILE, FROM_HERE, | 164 BrowserThread::FILE, FROM_HERE, |
161 NewRunnableFunction( | 165 NewRunnableFunction( |
162 &PluginService::RegisterFilePathWatcher, | 166 &PluginService::RegisterFilePathWatcher, |
163 watcher, plugin_dirs[i], file_watcher_delegate_)); | 167 watcher, plugin_dirs[i], file_watcher_delegate_)); |
164 file_watchers_.push_back(watcher); | 168 file_watchers_.push_back(watcher); |
165 } | 169 } |
166 #endif | 170 #endif |
167 #if defined(OS_MACOSX) | 171 #if defined(OS_MACOSX) |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 #if defined(OS_LINUX) | 510 #if defined(OS_LINUX) |
507 // static | 511 // static |
508 void PluginService::RegisterFilePathWatcher( | 512 void PluginService::RegisterFilePathWatcher( |
509 FilePathWatcher *watcher, | 513 FilePathWatcher *watcher, |
510 const FilePath& path, | 514 const FilePath& path, |
511 FilePathWatcher::Delegate* delegate) { | 515 FilePathWatcher::Delegate* delegate) { |
512 bool result = watcher->Watch(path, delegate); | 516 bool result = watcher->Watch(path, delegate); |
513 DCHECK(result); | 517 DCHECK(result); |
514 } | 518 } |
515 #endif | 519 #endif |
OLD | NEW |