blob: 04b1ae6daeee5e8e77d25f76e4c17688c8d4b721 [file] [log] [blame]
Chris Masone88cbd5f2011-07-03 14:30:04 -07001// Copyright (c) 2011 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_DEFAULT_PROFILE_
6#define SHILL_DEFAULT_PROFILE_
7
8#include <string>
9#include <vector>
10
Chris Masone2ae797d2011-08-23 20:41:00 -070011#include <base/file_path.h>
Chris Masone88cbd5f2011-07-03 14:30:04 -070012#include <base/memory/scoped_ptr.h>
Chris Masoneaa482372011-09-14 16:40:37 -070013#include <gtest/gtest_prod.h> // for FRIEND_TEST
Chris Masone88cbd5f2011-07-03 14:30:04 -070014
Paul Stewart26b327e2011-10-19 11:38:09 -070015#include "shill/event_dispatcher.h"
Chris Masone88cbd5f2011-07-03 14:30:04 -070016#include "shill/manager.h"
17#include "shill/profile.h"
18#include "shill/property_store.h"
19#include "shill/refptr_types.h"
Chris Masone88cbd5f2011-07-03 14:30:04 -070020
21namespace shill {
22
23class ControlInterface;
24
25class DefaultProfile : public Profile {
26 public:
Chris Masone2ae797d2011-08-23 20:41:00 -070027 DefaultProfile(ControlInterface *control,
Chris Masone6791a432011-07-12 13:23:19 -070028 Manager *manager,
Chris Masone2ae797d2011-08-23 20:41:00 -070029 const FilePath &storage_path,
Chris Masone88cbd5f2011-07-03 14:30:04 -070030 const Manager::Properties &manager_props);
31 virtual ~DefaultProfile();
32
Chris Masone877ff982011-09-21 16:18:24 -070033 // Persists profile information, as well as that of discovered devices
34 // and bound services, to disk.
35 // Returns true on success, false on failure.
Chris Masoneb9c00592011-10-06 13:10:39 -070036 virtual bool Save();
Chris Masoneaa482372011-09-14 16:40:37 -070037
Paul Stewart5dc40aa2011-10-28 19:43:43 -070038 protected:
Chris Masone2ae797d2011-08-23 20:41:00 -070039 // Sets |path| to the persistent store file path for the default, global
40 // profile. Returns true on success, and false if unable to determine an
41 // appropriate file location.
42 //
43 // In this implementation, |name_| is ignored.
44 virtual bool GetStoragePath(FilePath *path);
45
Chris Masone88cbd5f2011-07-03 14:30:04 -070046 private:
Chris Masoneaa482372011-09-14 16:40:37 -070047 FRIEND_TEST(DefaultProfileTest, Save);
Paul Stewart5dc40aa2011-10-28 19:43:43 -070048 FRIEND_TEST(DefaultProfileTest, GetStoragePath);
Chris Masoneaa482372011-09-14 16:40:37 -070049
Chris Masone7df0c672011-07-15 10:24:54 -070050 static const char kDefaultId[];
Chris Masoneaa482372011-09-14 16:40:37 -070051 static const char kStorageId[];
52 static const char kStorageCheckPortalList[];
53 static const char kStorageName[];
54 static const char kStorageOfflineMode[];
Chris Masone7df0c672011-07-15 10:24:54 -070055
Chris Masone2ae797d2011-08-23 20:41:00 -070056 const FilePath storage_path_;
Chris Masoneaa482372011-09-14 16:40:37 -070057 const Manager::Properties &props_;
Chris Masone2ae797d2011-08-23 20:41:00 -070058
Chris Masone88cbd5f2011-07-03 14:30:04 -070059 DISALLOW_COPY_AND_ASSIGN(DefaultProfile);
60};
61
62} // namespace shill
63
64#endif // SHILL_DEFAULT_PROFILE_