| 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 #include "chrome/browser/policy/file_based_policy_loader.h" | 5 #include "chrome/browser/policy/file_based_policy_loader.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "content/browser/browser_thread.h" | 8 #include "content/browser/browser_thread.h" |
| 9 | 9 |
| 10 using ::base::files::FilePathWatcher; |
| 11 |
| 10 namespace { | 12 namespace { |
| 11 | 13 |
| 12 // Amount of time we wait for the files on disk to settle before trying to load | 14 // Amount of time we wait for the files on disk to settle before trying to load |
| 13 // them. This alleviates the problem of reading partially written files and | 15 // them. This alleviates the problem of reading partially written files and |
| 14 // makes it possible to batch quasi-simultaneous changes. | 16 // makes it possible to batch quasi-simultaneous changes. |
| 15 const int kSettleIntervalSeconds = 5; | 17 const int kSettleIntervalSeconds = 5; |
| 16 | 18 |
| 17 // The time interval for rechecking policy. This is our fallback in case the | 19 // The time interval for rechecking policy. This is our fallback in case the |
| 18 // delegate never reports a change to the ReloadObserver. | 20 // delegate never reports a change to the ReloadObserver. |
| 19 const int kReloadIntervalMinutes = 15; | 21 const int kReloadIntervalMinutes = 15; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 base::TimeDelta age = now - last_modification_clock_; | 140 base::TimeDelta age = now - last_modification_clock_; |
| 139 if (age < settle_interval_) { | 141 if (age < settle_interval_) { |
| 140 *delay = settle_interval_ - age; | 142 *delay = settle_interval_ - age; |
| 141 return false; | 143 return false; |
| 142 } | 144 } |
| 143 | 145 |
| 144 return true; | 146 return true; |
| 145 } | 147 } |
| 146 | 148 |
| 147 } // namespace policy | 149 } // namespace policy |
| OLD | NEW |