Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 1 | // 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 Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 11 | #include <base/file_path.h> |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 12 | #include <base/memory/scoped_ptr.h> |
Chris Masone | aa48237 | 2011-09-14 16:40:37 -0700 | [diff] [blame] | 13 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 14 | |
| 15 | #include "shill/manager.h" |
| 16 | #include "shill/profile.h" |
| 17 | #include "shill/property_store.h" |
| 18 | #include "shill/refptr_types.h" |
| 19 | #include "shill/shill_event.h" |
| 20 | |
| 21 | namespace shill { |
| 22 | |
| 23 | class ControlInterface; |
| 24 | |
| 25 | class DefaultProfile : public Profile { |
| 26 | public: |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 27 | DefaultProfile(ControlInterface *control, |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 28 | Manager *manager, |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 29 | const FilePath &storage_path, |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 30 | const Manager::Properties &manager_props); |
| 31 | virtual ~DefaultProfile(); |
| 32 | |
Chris Masone | 877ff98 | 2011-09-21 16:18:24 -0700 | [diff] [blame] | 33 | // 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 Masone | b9c0059 | 2011-10-06 13:10:39 -0700 | [diff] [blame^] | 36 | virtual bool Save(); |
Chris Masone | aa48237 | 2011-09-14 16:40:37 -0700 | [diff] [blame] | 37 | |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 38 | // Sets |path| to the persistent store file path for the default, global |
| 39 | // profile. Returns true on success, and false if unable to determine an |
| 40 | // appropriate file location. |
| 41 | // |
| 42 | // In this implementation, |name_| is ignored. |
| 43 | virtual bool GetStoragePath(FilePath *path); |
| 44 | |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 45 | private: |
Chris Masone | aa48237 | 2011-09-14 16:40:37 -0700 | [diff] [blame] | 46 | FRIEND_TEST(DefaultProfileTest, Save); |
| 47 | |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 48 | static const char kDefaultId[]; |
Chris Masone | aa48237 | 2011-09-14 16:40:37 -0700 | [diff] [blame] | 49 | static const char kStorageId[]; |
| 50 | static const char kStorageCheckPortalList[]; |
| 51 | static const char kStorageName[]; |
| 52 | static const char kStorageOfflineMode[]; |
Chris Masone | 7df0c67 | 2011-07-15 10:24:54 -0700 | [diff] [blame] | 53 | |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 54 | const FilePath storage_path_; |
Chris Masone | aa48237 | 2011-09-14 16:40:37 -0700 | [diff] [blame] | 55 | const Manager::Properties &props_; |
Chris Masone | 2ae797d | 2011-08-23 20:41:00 -0700 | [diff] [blame] | 56 | |
Chris Masone | 88cbd5f | 2011-07-03 14:30:04 -0700 | [diff] [blame] | 57 | DISALLOW_COPY_AND_ASSIGN(DefaultProfile); |
| 58 | }; |
| 59 | |
| 60 | } // namespace shill |
| 61 | |
| 62 | #endif // SHILL_DEFAULT_PROFILE_ |