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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 LOG(WARNING) << "Expected JSON dictionary in configuration file " | 156 LOG(WARNING) << "Expected JSON dictionary in configuration file " |
157 << config_file_iter->value(); | 157 << config_file_iter->value(); |
158 return scoped_ptr<DictionaryValue>(); | 158 return scoped_ptr<DictionaryValue>(); |
159 } | 159 } |
160 policy->MergeDictionary(static_cast<DictionaryValue*>(value.get())); | 160 policy->MergeDictionary(static_cast<DictionaryValue*>(value.get())); |
161 } | 161 } |
162 | 162 |
163 return policy.Pass(); | 163 return policy.Pass(); |
164 } | 164 } |
165 | 165 |
166 void Reload() { | 166 virtual void Reload() OVERRIDE { |
167 DCHECK(OnPolicyWatcherThread()); | 167 DCHECK(OnPolicyWatcherThread()); |
168 // Check the directory time in order to see whether a reload is required. | 168 // Check the directory time in order to see whether a reload is required. |
169 base::TimeDelta delay; | 169 base::TimeDelta delay; |
170 base::Time now = base::Time::Now(); | 170 base::Time now = base::Time::Now(); |
171 if (!IsSafeToReloadPolicy(now, &delay)) { | 171 if (!IsSafeToReloadPolicy(now, &delay)) { |
172 ScheduleReloadTask(delay); | 172 ScheduleReloadTask(delay); |
173 return; | 173 return; |
174 } | 174 } |
175 | 175 |
176 // Check again in case the directory has changed while reading it. | 176 // Check again in case the directory has changed while reading it. |
(...skipping 69 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 base::FilePath policy_dir(kPolicyDir); | 250 base::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 |