| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Load the policy definitions. | 181 // Load the policy definitions. |
| 182 scoped_ptr<base::DictionaryValue> new_policy = Load(); | 182 scoped_ptr<base::DictionaryValue> new_policy = Load(); |
| 183 if (new_policy.get()) { | 183 if (new_policy.get()) { |
| 184 UpdatePolicies(new_policy.get()); | 184 UpdatePolicies(new_policy.get()); |
| 185 ScheduleFallbackReloadTask(); | 185 ScheduleFallbackReloadTask(); |
| 186 } else { | 186 } else { |
| 187 // A failure to load policy definitions is probably temporary, so try | 187 // A failure to load policy definitions is probably temporary, so try |
| 188 // again soon. | 188 // again soon. |
| 189 SignalTransientPolicyError(); |
| 189 ScheduleReloadTask(base::TimeDelta::FromSeconds(kSettleIntervalSeconds)); | 190 ScheduleReloadTask(base::TimeDelta::FromSeconds(kSettleIntervalSeconds)); |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 | 193 |
| 193 bool IsSafeToReloadPolicy(const base::Time& now, base::TimeDelta* delay) { | 194 bool IsSafeToReloadPolicy(const base::Time& now, base::TimeDelta* delay) { |
| 194 DCHECK(OnPolicyWatcherThread()); | 195 DCHECK(OnPolicyWatcherThread()); |
| 195 DCHECK(delay); | 196 DCHECK(delay); |
| 196 const base::TimeDelta kSettleInterval = | 197 const base::TimeDelta kSettleInterval = |
| 197 base::TimeDelta::FromSeconds(kSettleIntervalSeconds); | 198 base::TimeDelta::FromSeconds(kSettleIntervalSeconds); |
| 198 | 199 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 }; | 246 }; |
| 246 | 247 |
| 247 PolicyWatcher* PolicyWatcher::Create( | 248 PolicyWatcher* PolicyWatcher::Create( |
| 248 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 249 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 249 base::FilePath policy_dir(kPolicyDir); | 250 base::FilePath policy_dir(kPolicyDir); |
| 250 return new PolicyWatcherLinux(task_runner, policy_dir); | 251 return new PolicyWatcherLinux(task_runner, policy_dir); |
| 251 } | 252 } |
| 252 | 253 |
| 253 } // namespace policy_hack | 254 } // namespace policy_hack |
| 254 } // namespace remoting | 255 } // namespace remoting |
| OLD | NEW |