| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 virtual ~PolicyWatcherLinux() {} | 62 virtual ~PolicyWatcherLinux() {} |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 virtual void StartWatchingInternal() OVERRIDE { | 65 virtual void StartWatchingInternal() OVERRIDE { |
| 66 DCHECK(OnPolicyWatcherThread()); | 66 DCHECK(OnPolicyWatcherThread()); |
| 67 watcher_.reset(new base::files::FilePathWatcher()); | 67 watcher_.reset(new base::files::FilePathWatcher()); |
| 68 | 68 |
| 69 if (!config_dir_.empty() && | 69 if (!config_dir_.empty() && |
| 70 !watcher_->Watch( | 70 !watcher_->Watch( |
| 71 config_dir_, | 71 config_dir_, false, |
| 72 base::Bind(&PolicyWatcherLinux::OnFilePathChanged, | 72 base::Bind(&PolicyWatcherLinux::OnFilePathChanged, |
| 73 weak_factory_.GetWeakPtr()))) { | 73 weak_factory_.GetWeakPtr()))) { |
| 74 OnFilePathChanged(config_dir_, true); | 74 OnFilePathChanged(config_dir_, true); |
| 75 } | 75 } |
| 76 | 76 |
| 77 // There might have been changes to the directory in the time between | 77 // There might have been changes to the directory in the time between |
| 78 // construction of the loader and initialization of the watcher. Call reload | 78 // construction of the loader and initialization of the watcher. Call reload |
| 79 // to detect if that is the case. | 79 // to detect if that is the case. |
| 80 Reload(); | 80 Reload(); |
| 81 | 81 |
| (...skipping 164 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 FilePath policy_dir(kPolicyDir); | 250 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 |