| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Chromium OS 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. | 
|  | 4 |  | 
|  | 5 | #ifndef BUFFET_BUFFET_CONFIG_H_ | 
|  | 6 | #define BUFFET_BUFFET_CONFIG_H_ | 
|  | 7 |  | 
| Vitaly Buka | becd461 | 2015-08-16 23:31:55 -0700 | [diff] [blame] | 8 | #include <map> | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 9 | #include <set> | 
|  | 10 | #include <string> | 
|  | 11 | #include <vector> | 
|  | 12 |  | 
|  | 13 | #include <base/callback.h> | 
|  | 14 | #include <base/files/file_path.h> | 
|  | 15 | #include <chromeos/key_value_store.h> | 
| Alex Vakulenko | e32375b | 2015-09-28 08:55:40 -0700 | [diff] [blame] | 16 | #include <weave/provider/config_store.h> | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 17 |  | 
|  | 18 | namespace buffet { | 
|  | 19 |  | 
|  | 20 | class StorageInterface; | 
|  | 21 |  | 
|  | 22 | // Handles reading buffet config and state files. | 
| Alex Vakulenko | e32375b | 2015-09-28 08:55:40 -0700 | [diff] [blame] | 23 | class BuffetConfig final : public weave::provider::ConfigStore { | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 24 | public: | 
| Alex Vakulenko | 0022b75 | 2015-10-02 11:09:59 -0700 | [diff] [blame] | 25 | struct Options { | 
| Alex Vakulenko | 2915a7b | 2015-10-07 17:04:00 -0700 | [diff] [blame^] | 26 | std::string client_id; | 
|  | 27 | std::string client_secret; | 
|  | 28 | std::string api_key; | 
|  | 29 | std::string oauth_url; | 
|  | 30 | std::string service_url; | 
|  | 31 |  | 
| Alex Vakulenko | 0022b75 | 2015-10-02 11:09:59 -0700 | [diff] [blame] | 32 | base::FilePath defaults; | 
|  | 33 | base::FilePath settings; | 
|  | 34 |  | 
|  | 35 | base::FilePath definitions; | 
|  | 36 | base::FilePath test_definitions; | 
|  | 37 |  | 
|  | 38 | bool disable_security{false}; | 
|  | 39 | std::string test_privet_ssid; | 
|  | 40 | }; | 
|  | 41 |  | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 42 | ~BuffetConfig() override = default; | 
|  | 43 |  | 
| Alex Vakulenko | 0022b75 | 2015-10-02 11:09:59 -0700 | [diff] [blame] | 44 | explicit BuffetConfig(const Options& options); | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 45 |  | 
|  | 46 | // Config overrides. | 
|  | 47 | bool LoadDefaults(weave::Settings* settings) override; | 
|  | 48 | std::string LoadSettings() override; | 
|  | 49 | void SaveSettings(const std::string& settings) override; | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 50 |  | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 51 | bool LoadDefaults(const chromeos::KeyValueStore& store, | 
|  | 52 | weave::Settings* settings); | 
|  | 53 |  | 
|  | 54 | private: | 
| Alex Vakulenko | 0022b75 | 2015-10-02 11:09:59 -0700 | [diff] [blame] | 55 | Options options_; | 
| Vitaly Buka | 1175a9b | 2015-08-15 10:42:17 -0700 | [diff] [blame] | 56 |  | 
|  | 57 | DISALLOW_COPY_AND_ASSIGN(BuffetConfig); | 
|  | 58 | }; | 
|  | 59 |  | 
|  | 60 | }  // namespace buffet | 
|  | 61 |  | 
|  | 62 | #endif  // BUFFET_BUFFET_CONFIG_H_ |