Fix threading issue in CookieMonster task ordering.
[chromium-blink-merge.git] / chrome_frame / registry_watcher.h
blobbb72e8278d2b73eb5759dfe0f9c8c3edf649a1ff
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
3 // found in the LICENSE file.
4 //
5 // A utility class that makes it easy to register for registry change
6 // notifications.
7 //
9 #ifndef CHROME_FRAME_REGISTRY_WATCHER_H_
10 #define CHROME_FRAME_REGISTRY_WATCHER_H_
12 #include <windows.h>
14 class RegistryWatcher {
15 public:
16 typedef void (*NotifyFunc)();
17 RegistryWatcher(HKEY hive, const wchar_t* path, NotifyFunc callback);
18 ~RegistryWatcher();
20 bool StartWatching();
21 void StopWatching();
23 private:
24 static void CALLBACK WaitCallback(void* param, BOOLEAN wait_fired);
26 HKEY registry_key_;
28 HANDLE wait_event_;
29 HANDLE wait_handle_;
30 bool stopping_;
32 NotifyFunc callback_;
36 #endif // CHROME_FRAME_REGISTRY_WATCHER_H_