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 #include "remoting/host/policy_hack/nat_policy.h" | 5 #include "remoting/host/policy_hack/nat_policy.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop_proxy.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 | 15 |
16 namespace remoting { | 16 namespace remoting { |
17 namespace policy_hack { | 17 namespace policy_hack { |
18 | 18 |
19 // The MacOS version does not watch files because it is accepted | 19 // The MacOS version does not watch files because it is accepted |
20 // practice on the Mac that the user must logout/login for policies to be | 20 // practice on the Mac that the user must logout/login for policies to be |
21 // applied. This will actually pick up policies every | 21 // applied. This will actually pick up policies every |
22 // |kFallbackReloadDelayMinutes| which is sufficient for right now. | 22 // |kFallbackReloadDelayMinutes| which is sufficient for right now. |
23 class NatPolicyMac : public NatPolicy { | 23 class NatPolicyMac : public NatPolicy { |
24 public: | 24 public: |
25 explicit NatPolicyMac(base::MessageLoopProxy* message_loop_proxy) | 25 explicit NatPolicyMac(scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
26 : NatPolicy(message_loop_proxy) { | 26 : NatPolicy(task_runner) { |
27 } | 27 } |
28 | 28 |
29 virtual ~NatPolicyMac() { | 29 virtual ~NatPolicyMac() { |
30 } | 30 } |
31 | 31 |
32 protected: | 32 protected: |
33 virtual void StartWatchingInternal() OVERRIDE { | 33 virtual void StartWatchingInternal() OVERRIDE { |
34 Reload(); | 34 Reload(); |
35 } | 35 } |
36 | 36 |
(...skipping 19 matching lines...) Expand all Loading... |
56 | 56 |
57 // Set policy. Policy must be set (even if it is empty) so that the | 57 // Set policy. Policy must be set (even if it is empty) so that the |
58 // default policy is picked up the first time reload is called. | 58 // default policy is picked up the first time reload is called. |
59 UpdateNatPolicy(&policy); | 59 UpdateNatPolicy(&policy); |
60 | 60 |
61 // Reschedule task. | 61 // Reschedule task. |
62 ScheduleFallbackReloadTask(); | 62 ScheduleFallbackReloadTask(); |
63 } | 63 } |
64 }; | 64 }; |
65 | 65 |
66 NatPolicy* NatPolicy::Create(base::MessageLoopProxy* message_loop_proxy) { | 66 NatPolicy* NatPolicy::Create( |
67 return new NatPolicyMac(message_loop_proxy); | 67 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 68 return new NatPolicyMac(task_runner); |
68 } | 69 } |
69 | 70 |
70 } // namespace policy_hack | 71 } // namespace policy_hack |
71 } // namespace remoting | 72 } // namespace remoting |
OLD | NEW |