Paul Stewart | 0756db9 | 2012-01-27 08:34:47 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 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 SHILL_PROFILE_DBUS_PROPERTY_EXPORTER_ |
| 6 | #define SHILL_PROFILE_DBUS_PROPERTY_EXPORTER_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <base/basictypes.h> |
| 12 | #include <dbus-c++/dbus.h> |
| 13 | |
| 14 | namespace shill { |
| 15 | |
| 16 | class Error; |
| 17 | class StoreInterface; |
| 18 | |
| 19 | // This class is responsible for loading stored profile properties |
| 20 | // from storage for presentation using the Profile::GetEntry DBus |
| 21 | // API. Properties are loaded and presented in much the same way |
| 22 | // as a live service would present them. This is troublesome |
| 23 | // because it needs to duplicate (and stay in sync with) the way |
| 24 | // properties are loaded and presented in a real service. |
| 25 | // |
Paul Stewart | ee6b3d7 | 2013-07-12 16:07:51 -0700 | [diff] [blame] | 26 | // TODO(pstew): Get rid of this. It's nasty. crbug.com/208736 |
Paul Stewart | 0756db9 | 2012-01-27 08:34:47 -0800 | [diff] [blame] | 27 | class ProfileDBusPropertyExporter { |
| 28 | public: |
| 29 | typedef std::map<std::string, ::DBus::Variant> PropertyList; |
| 30 | |
| 31 | ProfileDBusPropertyExporter(const StoreInterface *storage, |
| 32 | const std::string &entry_name); |
| 33 | virtual ~ProfileDBusPropertyExporter(); |
| 34 | |
| 35 | bool LoadServiceProperties(PropertyList *properties, |
| 36 | Error *error); |
| 37 | |
| 38 | private: |
Paul Stewart | 4ebbdec | 2012-12-13 12:15:46 -0800 | [diff] [blame] | 39 | bool LoadEapServiceProperties(PropertyList *properties, |
| 40 | Error *error); |
Paul Stewart | 0756db9 | 2012-01-27 08:34:47 -0800 | [diff] [blame] | 41 | bool LoadWiFiServiceProperties(PropertyList *properties, |
| 42 | Error *error); |
| 43 | |
| 44 | bool LoadBool(PropertyList *properties, |
| 45 | const std::string &storage_name, |
| 46 | const std::string &dbus_name); |
| 47 | bool LoadString(PropertyList *properties, |
| 48 | const std::string &storage_name, |
| 49 | const std::string &dbus_name); |
| 50 | void SetBool(PropertyList *properties, |
| 51 | const std::string &dbus_name, |
| 52 | bool value); |
| 53 | void SetString(PropertyList *properties, |
| 54 | const std::string &dbus_name, |
| 55 | const std::string &value); |
| 56 | |
| 57 | const StoreInterface *storage_; |
| 58 | const std::string entry_name_; |
| 59 | |
| 60 | DISALLOW_COPY_AND_ASSIGN(ProfileDBusPropertyExporter); |
| 61 | }; |
| 62 | |
| 63 | } // namespace shill |
| 64 | |
| 65 | #endif // SHILL_PROFILE_DBUS_PROPERTY_EXPORTER_ |