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