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 // Most of this code is copied from various classes in | 5 // Most of this code is copied from various classes in |
6 // src/chrome/browser/policy. In particular, look at | 6 // src/chrome/browser/policy. In particular, look at |
7 // | 7 // |
8 // file_based_policy_loader.{h,cc} | 8 // file_based_policy_loader.{h,cc} |
9 // config_dir_policy_provider.{h,cc} | 9 // config_dir_policy_provider.{h,cc} |
10 // | 10 // |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const int kSettleIntervalSeconds = 5; | 43 const int kSettleIntervalSeconds = 5; |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 class PolicyWatcherLinux : public PolicyWatcher { | 47 class PolicyWatcherLinux : public PolicyWatcher { |
48 public: | 48 public: |
49 PolicyWatcherLinux(scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 49 PolicyWatcherLinux(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
50 const base::FilePath& config_dir) | 50 const base::FilePath& config_dir) |
51 : PolicyWatcher(task_runner), | 51 : PolicyWatcher(task_runner), |
52 config_dir_(config_dir), | 52 config_dir_(config_dir), |
53 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 53 weak_factory_(this) { |
54 // Detach the factory because we ensure that only the policy thread ever | 54 // Detach the factory because we ensure that only the policy thread ever |
55 // calls methods on this. Also, the API contract of having to call | 55 // calls methods on this. Also, the API contract of having to call |
56 // StopWatching() (which signals completion) after StartWatching() | 56 // StopWatching() (which signals completion) after StartWatching() |
57 // before this object can be destructed ensures there are no users of | 57 // before this object can be destructed ensures there are no users of |
58 // this object before it is destructed. | 58 // this object before it is destructed. |
59 weak_factory_.DetachFromThread(); | 59 weak_factory_.DetachFromThread(); |
60 } | 60 } |
61 | 61 |
62 virtual ~PolicyWatcherLinux() {} | 62 virtual ~PolicyWatcherLinux() {} |
63 | 63 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 }; | 246 }; |
247 | 247 |
248 PolicyWatcher* PolicyWatcher::Create( | 248 PolicyWatcher* PolicyWatcher::Create( |
249 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 249 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
250 base::FilePath policy_dir(kPolicyDir); | 250 base::FilePath policy_dir(kPolicyDir); |
251 return new PolicyWatcherLinux(task_runner, policy_dir); | 251 return new PolicyWatcherLinux(task_runner, policy_dir); |
252 } | 252 } |
253 | 253 |
254 } // namespace policy_hack | 254 } // namespace policy_hack |
255 } // namespace remoting | 255 } // namespace remoting |
OLD | NEW |