Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: content/browser/plugin_service.cc

Issue 6793020: Move FilePathWatcher to base/files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: plugin_service only uses FPW on linux Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // important plugins register themselves in the registry so no need to do that. 145 // important plugins register themselves in the registry so no need to do that.
142 #if defined(OS_LINUX) 146 #if defined(OS_LINUX)
143 file_watcher_delegate_ = new PluginDirWatcherDelegate(); 147 file_watcher_delegate_ = new PluginDirWatcherDelegate();
144 // Get the list of all paths for registering the FilePathWatchers 148 // Get the list of all paths for registering the FilePathWatchers
145 // that will track and if needed reload the list of plugins on runtime. 149 // that will track and if needed reload the list of plugins on runtime.
146 std::vector<FilePath> plugin_dirs; 150 std::vector<FilePath> plugin_dirs;
147 webkit::npapi::PluginList::Singleton()->GetPluginDirectories( 151 webkit::npapi::PluginList::Singleton()->GetPluginDirectories(
148 &plugin_dirs); 152 &plugin_dirs);
149 153
150 for (size_t i = 0; i < plugin_dirs.size(); ++i) { 154 for (size_t i = 0; i < plugin_dirs.size(); ++i) {
151 FilePathWatcher* watcher = new FilePathWatcher();
152 // FilePathWatcher can not handle non-absolute paths under windows. 155 // FilePathWatcher can not handle non-absolute paths under windows.
153 // We don't watch for file changes in windows now but if this should ever 156 // We don't watch for file changes in windows now but if this should ever
154 // be extended to Windows these lines might save some time of debugging. 157 // be extended to Windows these lines might save some time of debugging.
155 #if defined(OS_WIN) 158 #if defined(OS_WIN)
156 if (!plugin_dirs[i].IsAbsolute()) 159 if (!plugin_dirs[i].IsAbsolute())
157 continue; 160 continue;
158 #endif 161 #endif
162 FilePathWatcher* watcher = new FilePathWatcher();
159 VLOG(1) << "Watching for changes in: " << plugin_dirs[i].value(); 163 VLOG(1) << "Watching for changes in: " << plugin_dirs[i].value();
160 BrowserThread::PostTask( 164 BrowserThread::PostTask(
161 BrowserThread::FILE, FROM_HERE, 165 BrowserThread::FILE, FROM_HERE,
162 NewRunnableFunction( 166 NewRunnableFunction(
163 &PluginService::RegisterFilePathWatcher, 167 &PluginService::RegisterFilePathWatcher,
164 watcher, plugin_dirs[i], file_watcher_delegate_)); 168 watcher, plugin_dirs[i], file_watcher_delegate_));
165 file_watchers_.push_back(watcher); 169 file_watchers_.push_back(watcher);
166 } 170 }
167 #endif 171 #endif
168 #if defined(OS_MACOSX) 172 #if defined(OS_MACOSX)
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 #if defined(OS_LINUX) 511 #if defined(OS_LINUX)
508 // static 512 // static
509 void PluginService::RegisterFilePathWatcher( 513 void PluginService::RegisterFilePathWatcher(
510 FilePathWatcher *watcher, 514 FilePathWatcher *watcher,
511 const FilePath& path, 515 const FilePath& path,
512 FilePathWatcher::Delegate* delegate) { 516 FilePathWatcher::Delegate* delegate) {
513 bool result = watcher->Watch(path, delegate); 517 bool result = watcher->Watch(path, delegate);
514 DCHECK(result); 518 DCHECK(result);
515 } 519 }
516 #endif 520 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698