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

Side by Side Diff: chrome/browser/file_path_watcher/file_path_watcher_win.cc

Issue 5971008: move base/object_watcher into base/win and add the win namespace. Fixup calle... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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/win/object_watcher_unittest.cc ('k') | chrome/browser/first_run/first_run_win.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/file_path_watcher/file_path_watcher.h" 5 #include "chrome/browser/file_path_watcher/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/object_watcher.h"
11 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
12 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/win/object_watcher.h"
13 13
14 namespace { 14 namespace {
15 15
16 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate, 16 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate,
17 public base::ObjectWatcher::Delegate { 17 public base::win::ObjectWatcher::Delegate {
18 public: 18 public:
19 FilePathWatcherImpl() : delegate_(NULL), handle_(INVALID_HANDLE_VALUE) {} 19 FilePathWatcherImpl() : delegate_(NULL), handle_(INVALID_HANDLE_VALUE) {}
20 20
21 virtual bool Watch(const FilePath& path, FilePathWatcher::Delegate* delegate); 21 virtual bool Watch(const FilePath& path, FilePathWatcher::Delegate* delegate);
22 virtual void Cancel(); 22 virtual void Cancel();
23 23
24 // Callback from MessageLoopForIO. 24 // Callback from MessageLoopForIO.
25 virtual void OnObjectSignaled(HANDLE object); 25 virtual void OnObjectSignaled(HANDLE object);
26 26
27 private: 27 private:
(...skipping 14 matching lines...) Expand all
42 // Delegate to notify upon changes. 42 // Delegate to notify upon changes.
43 scoped_refptr<FilePathWatcher::Delegate> delegate_; 43 scoped_refptr<FilePathWatcher::Delegate> delegate_;
44 44
45 // Path we're supposed to watch (passed to delegate). 45 // Path we're supposed to watch (passed to delegate).
46 FilePath target_; 46 FilePath target_;
47 47
48 // Handle for FindFirstChangeNotification. 48 // Handle for FindFirstChangeNotification.
49 HANDLE handle_; 49 HANDLE handle_;
50 50
51 // ObjectWatcher to watch handle_ for events. 51 // ObjectWatcher to watch handle_ for events.
52 base::ObjectWatcher watcher_; 52 base::win::ObjectWatcher watcher_;
53 53
54 // Keep track of the last modified time of the file. We use nulltime 54 // Keep track of the last modified time of the file. We use nulltime
55 // to represent the file not existing. 55 // to represent the file not existing.
56 base::Time last_modified_; 56 base::Time last_modified_;
57 57
58 // The time at which we processed the first notification with the 58 // The time at which we processed the first notification with the
59 // |last_modified_| time stamp. 59 // |last_modified_| time stamp.
60 base::Time first_notification_; 60 base::Time first_notification_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherImpl); 62 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherImpl);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 watcher_.StopWatching(); 235 watcher_.StopWatching();
236 FindCloseChangeNotification(handle_); 236 FindCloseChangeNotification(handle_);
237 handle_ = INVALID_HANDLE_VALUE; 237 handle_ = INVALID_HANDLE_VALUE;
238 } 238 }
239 239
240 } // namespace 240 } // namespace
241 241
242 FilePathWatcher::FilePathWatcher() { 242 FilePathWatcher::FilePathWatcher() {
243 impl_ = new FilePathWatcherImpl(); 243 impl_ = new FilePathWatcherImpl();
244 } 244 }
OLDNEW
« no previous file with comments | « base/win/object_watcher_unittest.cc ('k') | chrome/browser/first_run/first_run_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698