| 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 #include "remoting/host/config_file_watcher.h" | 5 #include "remoting/host/config_file_watcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Create the timer that will be used for delayed-reading the configuration | 115 // Create the timer that will be used for delayed-reading the configuration |
| 116 // file. | 116 // file. |
| 117 config_updated_timer_.reset(new base::DelayTimer<ConfigFileWatcherImpl>( | 117 config_updated_timer_.reset(new base::DelayTimer<ConfigFileWatcherImpl>( |
| 118 FROM_HERE, base::TimeDelta::FromSeconds(2), this, | 118 FROM_HERE, base::TimeDelta::FromSeconds(2), this, |
| 119 &ConfigFileWatcherImpl::ReloadConfig)); | 119 &ConfigFileWatcherImpl::ReloadConfig)); |
| 120 | 120 |
| 121 // Start watching the configuration file. | 121 // Start watching the configuration file. |
| 122 config_watcher_.reset(new base::files::FilePathWatcher()); | 122 config_watcher_.reset(new base::files::FilePathWatcher()); |
| 123 config_path_ = config_path; | 123 config_path_ = config_path; |
| 124 if (!config_watcher_->Watch( | 124 if (!config_watcher_->Watch( |
| 125 config_path_, | 125 config_path_, false, |
| 126 base::Bind(&ConfigFileWatcherImpl::OnConfigUpdated, this))) { | 126 base::Bind(&ConfigFileWatcherImpl::OnConfigUpdated, this))) { |
| 127 LOG(ERROR) << "Couldn't watch file '" << config_path_.value() << "'"; | 127 LOG(ERROR) << "Couldn't watch file '" << config_path_.value() << "'"; |
| 128 main_task_runner_->PostTask( | 128 main_task_runner_->PostTask( |
| 129 FROM_HERE, | 129 FROM_HERE, |
| 130 base::Bind(&ConfigFileWatcher::Delegate::OnConfigWatcherError, | 130 base::Bind(&ConfigFileWatcher::Delegate::OnConfigWatcherError, |
| 131 delegate_)); | 131 delegate_)); |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Force reloading of the configuration file at least once. | 135 // Force reloading of the configuration file at least once. |
| 136 ReloadConfig(); | 136 ReloadConfig(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (config_ != config) { | 184 if (config_ != config) { |
| 185 config_ = config; | 185 config_ = config; |
| 186 main_task_runner_->PostTask( | 186 main_task_runner_->PostTask( |
| 187 FROM_HERE, | 187 FROM_HERE, |
| 188 base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_, | 188 base::Bind(&ConfigFileWatcher::Delegate::OnConfigUpdated, delegate_, |
| 189 config_)); | 189 config_)); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace remoting | 193 } // namespace remoting |
| OLD | NEW |