blob: 342fae66022cec247294e88237d69384af88dd97 [file] [log] [blame]
Paul Stewart0756db92012-01-27 08:34:47 -08001// 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
14namespace shill {
15
16class Error;
17class 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 Stewartee6b3d72013-07-12 16:07:51 -070026// TODO(pstew): Get rid of this. It's nasty. crbug.com/208736
Paul Stewart0756db92012-01-27 08:34:47 -080027class 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 Stewart4ebbdec2012-12-13 12:15:46 -080039 bool LoadEapServiceProperties(PropertyList *properties,
40 Error *error);
Paul Stewart0756db92012-01-27 08:34:47 -080041 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_