| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 DCHECK(OnPolicyThread()); | 64 DCHECK(OnPolicyThread()); |
| 65 watcher_.reset(new base::files::FilePathWatcher()); | 65 watcher_.reset(new base::files::FilePathWatcher()); |
| 66 | 66 |
| 67 if (!config_dir_.empty() && | 67 if (!config_dir_.empty() && |
| 68 !watcher_->Watch( | 68 !watcher_->Watch( |
| 69 config_dir_, | 69 config_dir_, |
| 70 new FilePathWatcherDelegate(weak_factory_.GetWeakPtr()))) { | 70 new FilePathWatcherDelegate(weak_factory_.GetWeakPtr()))) { |
| 71 OnFilePathError(config_dir_); | 71 OnFilePathError(config_dir_); |
| 72 } | 72 } |
| 73 | 73 |
| 74 LOG(ERROR) << "Start Watching"; |
| 75 |
| 74 // There might have been changes to the directory in the time between | 76 // There might have been changes to the directory in the time between |
| 75 // construction of the loader and initialization of the watcher. Call reload | 77 // construction of the loader and initialization of the watcher. Call reload |
| 76 // to detect if that is the case. | 78 // to detect if that is the case. |
| 77 Reload(); | 79 Reload(); |
| 78 | 80 |
| 79 ScheduleFallbackReloadTask(); | 81 ScheduleFallbackReloadTask(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 virtual void StopWatchingInternal() OVERRIDE { | 84 virtual void StopWatchingInternal() OVERRIDE { |
| 85 LOG(ERROR) << "Stop Watching"; |
| 83 DCHECK(OnPolicyThread()); | 86 DCHECK(OnPolicyThread()); |
| 84 // Cancel any inflight requests. | 87 // Cancel any inflight requests. |
| 85 watcher_.reset(); | 88 watcher_.reset(); |
| 86 } | 89 } |
| 87 | 90 |
| 88 // Called by FilePathWatcherDelegate. | 91 // Called by FilePathWatcherDelegate. |
| 89 virtual void OnFilePathError(const FilePath& path) { | 92 virtual void OnFilePathError(const FilePath& path) { |
| 90 LOG(ERROR) << "NatPolicyLinux on " << path.value() | 93 LOG(ERROR) << "NatPolicyLinux on " << path.value() |
| 91 << " failed."; | 94 << " failed."; |
| 92 } | 95 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 base::WeakPtrFactory<NatPolicyLinux> weak_factory_; | 264 base::WeakPtrFactory<NatPolicyLinux> weak_factory_; |
| 262 }; | 265 }; |
| 263 | 266 |
| 264 NatPolicy* NatPolicy::Create(base::MessageLoopProxy* message_loop_proxy) { | 267 NatPolicy* NatPolicy::Create(base::MessageLoopProxy* message_loop_proxy) { |
| 265 FilePath policy_dir(kPolicyDir); | 268 FilePath policy_dir(kPolicyDir); |
| 266 return new NatPolicyLinux(message_loop_proxy, policy_dir); | 269 return new NatPolicyLinux(message_loop_proxy, policy_dir); |
| 267 } | 270 } |
| 268 | 271 |
| 269 } // namespace policy_hack | 272 } // namespace policy_hack |
| 270 } // namespace remoting | 273 } // namespace remoting |
| OLD | NEW |