| 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" |
| 11 #include "remoting/host/chromoting_host_context.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class SingleThreadTaskRunner; | 14 class SingleThreadTaskRunner; |
| 14 class TimeDelta; | 15 class TimeDelta; |
| 15 class WaitableEvent; | 16 class WaitableEvent; |
| 16 } // namespace base | 17 } // namespace base |
| 17 | 18 |
| 18 namespace remoting { | 19 namespace remoting { |
| 19 namespace policy_hack { | 20 namespace policy_hack { |
| 20 | 21 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 32 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 32 virtual ~PolicyWatcher(); | 33 virtual ~PolicyWatcher(); |
| 33 | 34 |
| 34 // This guarantees that the |policy_callback| is called at least once with | 35 // This guarantees that the |policy_callback| is called at least once with |
| 35 // the current policies. After that, |policy_callback| will be called | 36 // 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 | 37 // whenever a change to any policy is detected. It will then be called only |
| 37 // with the changed policies. | 38 // with the changed policies. |
| 38 virtual void StartWatching(const PolicyCallback& policy_callback); | 39 virtual void StartWatching(const PolicyCallback& policy_callback); |
| 39 | 40 |
| 40 // Should be called after StartWatching() before the object is deleted. Calls | 41 // Should be called after StartWatching() before the object is deleted. Calls |
| 41 // just wait for |done| to be signaled before deleting the object. | 42 // should wait for |stopped_callback| to be called before deleting the object. |
| 42 virtual void StopWatching(base::WaitableEvent* done); | 43 virtual void StopWatching(const base::Closure& stopped_callback); |
| 43 | 44 |
| 44 // Implemented by each platform. This message loop should be an IO message | 45 // Implemented by each platform. This message loop should be an IO message |
| 45 // loop. | 46 // loop. |
| 46 static PolicyWatcher* Create( | 47 static PolicyWatcher* Create( |
| 48 ChromotingHostContext* context, |
| 47 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 49 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 48 | 50 |
| 49 // The name of the NAT traversal policy. | 51 // The name of the NAT traversal policy. |
| 50 static const char kNatPolicyName[]; | 52 static const char kNatPolicyName[]; |
| 51 | 53 |
| 52 // The name of the policy for requiring 2-factor authentication. | 54 // The name of the policy for requiring 2-factor authentication. |
| 53 static const char kHostRequireTwoFactorPolicyName[]; | 55 static const char kHostRequireTwoFactorPolicyName[]; |
| 54 | 56 |
| 55 // The name of the host domain policy. | 57 // The name of the host domain policy. |
| 56 static const char kHostDomainPolicyName[]; | 58 static const char kHostDomainPolicyName[]; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 scoped_ptr<base::DictionaryValue> bad_type_values_; | 118 scoped_ptr<base::DictionaryValue> bad_type_values_; |
| 117 | 119 |
| 118 // Allows us to cancel any inflight FileWatcher events or scheduled reloads. | 120 // Allows us to cancel any inflight FileWatcher events or scheduled reloads. |
| 119 base::WeakPtrFactory<PolicyWatcher> weak_factory_; | 121 base::WeakPtrFactory<PolicyWatcher> weak_factory_; |
| 120 }; | 122 }; |
| 121 | 123 |
| 122 } // namespace policy_hack | 124 } // namespace policy_hack |
| 123 } // namespace remoting | 125 } // namespace remoting |
| 124 | 126 |
| 125 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ | 127 #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ |
| OLD | NEW |