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

Side by Side Diff: base/files/file_path_watcher_win.cc

Issue 6793020: Move FilePathWatcher to base/files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use ::operator<< 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
« no previous file with comments | « base/files/file_path_watcher_stub.cc ('k') | chrome/browser/policy/file_based_policy_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/file_path_watcher/file_path_watcher.h" 5 #include "base/files/file_path_watcher.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/message_loop_proxy.h" 11 #include "base/message_loop_proxy.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "base/win/object_watcher.h" 13 #include "base/win/object_watcher.h"
14 14
15 namespace base {
16 namespace files {
17
15 namespace { 18 namespace {
16 19
17 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate, 20 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate,
18 public base::win::ObjectWatcher::Delegate, 21 public base::win::ObjectWatcher::Delegate,
19 public MessageLoop::DestructionObserver { 22 public MessageLoop::DestructionObserver {
20 public: 23 public:
21 FilePathWatcherImpl() : delegate_(NULL), handle_(INVALID_HANDLE_VALUE) {} 24 FilePathWatcherImpl() : delegate_(NULL), handle_(INVALID_HANDLE_VALUE) {}
22 25
23 // FilePathWatcher::PlatformDelegate overrides. 26 // FilePathWatcher::PlatformDelegate overrides.
24 virtual bool Watch(const FilePath& path, 27 virtual bool Watch(const FilePath& path,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // If FindFirstChangeNotification failed because the target directory 198 // If FindFirstChangeNotification failed because the target directory
196 // doesn't exist, access is denied (happens if the file is already gone but 199 // doesn't exist, access is denied (happens if the file is already gone but
197 // there are still handles open), or the target is not a directory, try the 200 // there are still handles open), or the target is not a directory, try the
198 // immediate parent directory instead. 201 // immediate parent directory instead.
199 DWORD error_code = GetLastError(); 202 DWORD error_code = GetLastError();
200 if (error_code != ERROR_FILE_NOT_FOUND && 203 if (error_code != ERROR_FILE_NOT_FOUND &&
201 error_code != ERROR_PATH_NOT_FOUND && 204 error_code != ERROR_PATH_NOT_FOUND &&
202 error_code != ERROR_ACCESS_DENIED && 205 error_code != ERROR_ACCESS_DENIED &&
203 error_code != ERROR_SHARING_VIOLATION && 206 error_code != ERROR_SHARING_VIOLATION &&
204 error_code != ERROR_DIRECTORY) { 207 error_code != ERROR_DIRECTORY) {
208 using ::operator<<; // Pick the right operator<< below.
205 PLOG(ERROR) << "FindFirstChangeNotification failed for " 209 PLOG(ERROR) << "FindFirstChangeNotification failed for "
206 << dir.value(); 210 << dir.value();
207 return false; 211 return false;
208 } 212 }
209 213
210 return true; 214 return true;
211 } 215 }
212 216
213 bool FilePathWatcherImpl::UpdateWatch() { 217 bool FilePathWatcherImpl::UpdateWatch() {
214 if (handle_ != INVALID_HANDLE_VALUE) 218 if (handle_ != INVALID_HANDLE_VALUE)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 watcher_.StopWatching(); 269 watcher_.StopWatching();
266 FindCloseChangeNotification(handle_); 270 FindCloseChangeNotification(handle_);
267 handle_ = INVALID_HANDLE_VALUE; 271 handle_ = INVALID_HANDLE_VALUE;
268 } 272 }
269 273
270 } // namespace 274 } // namespace
271 275
272 FilePathWatcher::FilePathWatcher() { 276 FilePathWatcher::FilePathWatcher() {
273 impl_ = new FilePathWatcherImpl(); 277 impl_ = new FilePathWatcherImpl();
274 } 278 }
279
280 } // namespace files
281 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_stub.cc ('k') | chrome/browser/policy/file_based_policy_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698