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

Side by Side Diff: net/dns/notify_watcher_mac.h

Issue 9969190: [net/dns] Watch configd notifications to detect DnsConfig changes on Mac. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed missing ':'. Created 8 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
« no previous file with comments | « net/dns/file_path_watcher_wrapper.h ('k') | net/dns/notify_watcher_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_DNS_NOTIFY_WATCHER_MAC_H_
6 #define NET_DNS_NOTIFY_WATCHER_MAC_H_
7 #pragma once
8
9 #include "base/callback.h"
10 #include "base/message_loop.h"
11
12 namespace net {
13
14 // Watches for notifications from Libnotify and delivers them to a Callback.
15 // After failure the watch is cancelled and will have to be restarted.
16 class NotifyWatcherMac : public MessageLoopForIO::Watcher {
17 public:
18 // Called on received notification with true on success and false on error.
19 typedef base::Callback<void(bool succeeded)> CallbackType;
20
21 NotifyWatcherMac();
22
23 // When deleted, automatically cancels.
24 virtual ~NotifyWatcherMac();
25
26 // Registers for notifications for |key|. Returns true if succeeds. If so,
27 // will deliver asynchronous notifications and errors to |callback|.
28 bool Watch(const char* key, const CallbackType& callback);
29
30 // Cancels the watch.
31 void Cancel();
32
33 private:
34 // MessageLoopForIO::Watcher:
35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {}
37
38 int notify_fd_;
39 int notify_token_;
40 CallbackType callback_;
41 MessageLoopForIO::FileDescriptorWatcher watcher_;
42
43 DISALLOW_COPY_AND_ASSIGN(NotifyWatcherMac);
44 };
45
46 } // namespace net
47
48 #endif // NET_DNS_NOTIFY_WATCHER_MAC_H_
OLDNEW
« no previous file with comments | « net/dns/file_path_watcher_wrapper.h ('k') | net/dns/notify_watcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698