OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
13 #include "chromeos/dbus/shill_manager_client.h" | 14 #include "chromeos/dbus/shill_manager_client.h" |
14 #include "chromeos/dbus/shill_profile_client.h" | 15 #include "chromeos/dbus/shill_profile_client.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
18 // A stub implementation of ShillProfileClient. | 19 // A stub implementation of ShillProfileClient. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 bool UpdateService(const std::string& profile_path, | 56 bool UpdateService(const std::string& profile_path, |
56 const std::string& service_path) override; | 57 const std::string& service_path) override; |
57 void GetProfilePaths(std::vector<std::string>* profiles) override; | 58 void GetProfilePaths(std::vector<std::string>* profiles) override; |
58 bool GetService(const std::string& service_path, | 59 bool GetService(const std::string& service_path, |
59 std::string* profile_path, | 60 std::string* profile_path, |
60 base::DictionaryValue* properties) override; | 61 base::DictionaryValue* properties) override; |
61 void ClearProfiles() override; | 62 void ClearProfiles() override; |
62 | 63 |
63 private: | 64 private: |
64 struct ProfileProperties; | 65 struct ProfileProperties; |
65 typedef std::map<std::string, ProfileProperties*> ProfileMap; | 66 using ProfileMap = std::map<std::string, std::unique_ptr<ProfileProperties>>; |
66 | 67 |
67 bool AddOrUpdateServiceImpl(const std::string& profile_path, | 68 bool AddOrUpdateServiceImpl(const std::string& profile_path, |
68 const std::string& service_path, | 69 const std::string& service_path, |
69 ProfileProperties* profile); | 70 ProfileProperties* profile); |
70 | 71 |
71 ProfileProperties* GetProfile(const dbus::ObjectPath& profile_path, | 72 ProfileProperties* GetProfile(const dbus::ObjectPath& profile_path, |
72 const ErrorCallback& error_callback); | 73 const ErrorCallback& error_callback); |
73 | 74 |
74 // The values are owned by this class and are explicitly destroyed where | |
75 // necessary. | |
76 ProfileMap profiles_; | 75 ProfileMap profiles_; |
77 | 76 |
78 DISALLOW_COPY_AND_ASSIGN(FakeShillProfileClient); | 77 DISALLOW_COPY_AND_ASSIGN(FakeShillProfileClient); |
79 }; | 78 }; |
80 | 79 |
81 } // namespace chromeos | 80 } // namespace chromeos |
82 | 81 |
83 #endif // CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ | 82 #endif // CHROMEOS_DBUS_FAKE_SHILL_PROFILE_CLIENT_H_ |
OLD | NEW |