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 "content/browser/browser_thread.h" | 7 #include "content/browser/browser_thread.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 ScheduleFallbackReloadTask(); | 91 ScheduleFallbackReloadTask(); |
92 } | 92 } |
93 | 93 |
94 void FileBasedPolicyLoader::InitOnFileThread() { | 94 void FileBasedPolicyLoader::InitOnFileThread() { |
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
96 watcher_.reset(new FilePathWatcher); | 96 watcher_.reset(new FilePathWatcher); |
97 if (!config_file_path().empty() && | 97 if (!config_file_path().empty() && |
98 !watcher_->Watch( | 98 !watcher_->Watch( |
99 config_file_path(), | 99 config_file_path(), |
100 new FileBasedPolicyWatcherDelegate(this), | 100 new FileBasedPolicyWatcherDelegate(this))) { |
101 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))) { | |
102 OnError(); | 101 OnError(); |
103 } | 102 } |
104 | 103 |
105 // There might have been changes to the directory in the time between | 104 // There might have been changes to the directory in the time between |
106 // construction of the loader and initialization of the watcher. Call reload | 105 // construction of the loader and initialization of the watcher. Call reload |
107 // to detect if that is the case. | 106 // to detect if that is the case. |
108 Reload(); | 107 Reload(); |
109 | 108 |
110 ScheduleFallbackReloadTask(); | 109 ScheduleFallbackReloadTask(); |
111 } | 110 } |
(...skipping 27 matching lines...) Expand all Loading... |
139 base::TimeDelta age = now - last_modification_clock_; | 138 base::TimeDelta age = now - last_modification_clock_; |
140 if (age < settle_interval_) { | 139 if (age < settle_interval_) { |
141 *delay = settle_interval_ - age; | 140 *delay = settle_interval_ - age; |
142 return false; | 141 return false; |
143 } | 142 } |
144 | 143 |
145 return true; | 144 return true; |
146 } | 145 } |
147 | 146 |
148 } // namespace policy | 147 } // namespace policy |
OLD | NEW |