| 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 "base/files/file_path_watcher.h" | 5 #include "base/files/file_path_watcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // If FindFirstChangeNotification failed because the target directory | 226 // If FindFirstChangeNotification failed because the target directory |
| 227 // doesn't exist, access is denied (happens if the file is already gone but | 227 // doesn't exist, access is denied (happens if the file is already gone but |
| 228 // there are still handles open), or the target is not a directory, try the | 228 // there are still handles open), or the target is not a directory, try the |
| 229 // immediate parent directory instead. | 229 // immediate parent directory instead. |
| 230 DWORD error_code = GetLastError(); | 230 DWORD error_code = GetLastError(); |
| 231 if (error_code != ERROR_FILE_NOT_FOUND && | 231 if (error_code != ERROR_FILE_NOT_FOUND && |
| 232 error_code != ERROR_PATH_NOT_FOUND && | 232 error_code != ERROR_PATH_NOT_FOUND && |
| 233 error_code != ERROR_ACCESS_DENIED && | 233 error_code != ERROR_ACCESS_DENIED && |
| 234 error_code != ERROR_SHARING_VIOLATION && | 234 error_code != ERROR_SHARING_VIOLATION && |
| 235 error_code != ERROR_DIRECTORY) { | 235 error_code != ERROR_DIRECTORY) { |
| 236 using ::operator<<; // Pick the right operator<< below. | |
| 237 DPLOG(ERROR) << "FindFirstChangeNotification failed for " | 236 DPLOG(ERROR) << "FindFirstChangeNotification failed for " |
| 238 << dir.value(); | 237 << dir.value(); |
| 239 return false; | 238 return false; |
| 240 } | 239 } |
| 241 | 240 |
| 242 return true; | 241 return true; |
| 243 } | 242 } |
| 244 | 243 |
| 245 bool FilePathWatcherImpl::UpdateWatch() { | 244 bool FilePathWatcherImpl::UpdateWatch() { |
| 246 if (handle_ != INVALID_HANDLE_VALUE) | 245 if (handle_ != INVALID_HANDLE_VALUE) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 handle_ = INVALID_HANDLE_VALUE; | 292 handle_ = INVALID_HANDLE_VALUE; |
| 294 } | 293 } |
| 295 | 294 |
| 296 } // namespace | 295 } // namespace |
| 297 | 296 |
| 298 FilePathWatcher::FilePathWatcher() { | 297 FilePathWatcher::FilePathWatcher() { |
| 299 impl_ = new FilePathWatcherImpl(); | 298 impl_ = new FilePathWatcherImpl(); |
| 300 } | 299 } |
| 301 | 300 |
| 302 } // namespace base | 301 } // namespace base |
| OLD | NEW |