OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ | 5 #ifndef REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ |
6 #define REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ | 6 #define REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
32 virtual ~PolicyWatcher(); | 32 virtual ~PolicyWatcher(); |
33 | 33 |
34 // This guarantees that the |policy_callback| is called at least once with | 34 // This guarantees that the |policy_callback| is called at least once with |
35 // the current policies. After that, |policy_callback| will be called | 35 // the current policies. After that, |policy_callback| will be called |
36 // whenever a change to any policy is detected. It will then be called only | 36 // whenever a change to any policy is detected. It will then be called only |
37 // with the changed policies. | 37 // with the changed policies. |
38 virtual void StartWatching(const PolicyCallback& policy_callback); | 38 virtual void StartWatching(const PolicyCallback& policy_callback); |
39 | 39 |
40 // Should be called after StartWatching() before the object is deleted. Calls | 40 // Should be called after StartWatching() before the object is deleted. Calls |
41 // just wait for |done| to be signaled before deleting the object. | 41 // should wait for |stopped_callback| to be called before deleting the object. |
42 virtual void StopWatching(base::WaitableEvent* done); | 42 virtual void StopWatching(const base::Closure& stopped_callback); |
43 | 43 |
44 // Implemented by each platform. This message loop should be an IO message | 44 // Implemented by each platform. This message loop should be an IO message |
45 // loop. | 45 // loop. |
46 static PolicyWatcher* Create( | 46 static PolicyWatcher* Create( |
47 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 47 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
48 | 48 |
49 // The name of the NAT traversal policy. | 49 // The name of the NAT traversal policy. |
50 static const char kNatPolicyName[]; | 50 static const char kNatPolicyName[]; |
51 | 51 |
52 // The name of the policy for requiring 2-factor authentication. | 52 // The name of the policy for requiring 2-factor authentication. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 scoped_ptr<base::DictionaryValue> bad_type_values_; | 116 scoped_ptr<base::DictionaryValue> bad_type_values_; |
117 | 117 |
118 // Allows us to cancel any inflight FileWatcher events or scheduled reloads. | 118 // Allows us to cancel any inflight FileWatcher events or scheduled reloads. |
119 base::WeakPtrFactory<PolicyWatcher> weak_factory_; | 119 base::WeakPtrFactory<PolicyWatcher> weak_factory_; |
120 }; | 120 }; |
121 | 121 |
122 } // namespace policy_hack | 122 } // namespace policy_hack |
123 } // namespace remoting | 123 } // namespace remoting |
124 | 124 |
125 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ | 125 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ |
OLD | NEW |