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
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_DAEMON_CONFIG_WATCHER_H_
6 #define REMOTING_HOST_DAEMON_CONFIG_WATCHER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h"
14 class SingleThreadTaskRunner;
19 extern const char kHostConfigSwitchName[];
20 extern const base::FilePath::CharType kDefaultHostConfigFile[];
22 class ConfigFileWatcherImpl;
24 class ConfigFileWatcher {
30 // Called once after starting watching the configuration file and every time
32 virtual void OnConfigUpdated(const std::string& serialized_config) = 0;
34 // Called when the configuration file watcher encountered an error.
35 virtual void OnConfigWatcherError() = 0;
38 // Creates a configuration file watcher that lives at the |io_task_runner|
39 // thread but posts config file updates on on |main_task_runner|.
41 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
42 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
44 virtual ~ConfigFileWatcher();
46 // Starts watching |config_path|.
47 void Watch(const base::FilePath& config_path);
50 scoped_refptr<ConfigFileWatcherImpl> impl_;
52 DISALLOW_COPY_AND_ASSIGN(ConfigFileWatcher);
55 } // namespace remoting
57 #endif // REMOTING_HOST_DAEMON_CONFIG_WATCHER_H_