| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 if (!error) | 94 if (!error) |
| 95 Reload(); | 95 Reload(); |
| 96 else | 96 else |
| 97 LOG(ERROR) << "PolicyWatcherLinux on " << path.value() << " failed."; | 97 LOG(ERROR) << "PolicyWatcherLinux on " << path.value() << " failed."; |
| 98 } | 98 } |
| 99 | 99 |
| 100 base::Time GetLastModification() { | 100 base::Time GetLastModification() { |
| 101 DCHECK(OnPolicyWatcherThread()); | 101 DCHECK(OnPolicyWatcherThread()); |
| 102 base::Time last_modification = base::Time(); | 102 base::Time last_modification = base::Time(); |
| 103 base::PlatformFileInfo file_info; | 103 base::File::Info file_info; |
| 104 | 104 |
| 105 // If the path does not exist or points to a directory, it's safe to load. | 105 // If the path does not exist or points to a directory, it's safe to load. |
| 106 if (!base::GetFileInfo(config_dir_, &file_info) || | 106 if (!base::GetFileInfo(config_dir_, &file_info) || |
| 107 !file_info.is_directory) { | 107 !file_info.is_directory) { |
| 108 return last_modification; | 108 return last_modification; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Enumerate the files and find the most recent modification timestamp. | 111 // Enumerate the files and find the most recent modification timestamp. |
| 112 base::FileEnumerator file_enumerator(config_dir_, | 112 base::FileEnumerator file_enumerator(config_dir_, |
| 113 false, | 113 false, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 PolicyWatcher* PolicyWatcher::Create( | 247 PolicyWatcher* PolicyWatcher::Create( |
| 248 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 248 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 249 base::FilePath policy_dir(kPolicyDir); | 249 base::FilePath policy_dir(kPolicyDir); |
| 250 return new PolicyWatcherLinux(task_runner, policy_dir); | 250 return new PolicyWatcherLinux(task_runner, policy_dir); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace policy_hack | 253 } // namespace policy_hack |
| 254 } // namespace remoting | 254 } // namespace remoting |
| OLD | NEW |