OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 15 #include "chromeos/network/network_handler.h" |
15 #include "chromeos/network/network_handler_callbacks.h" | 16 #include "chromeos/network/network_handler_callbacks.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class DictionaryValue; | 19 class DictionaryValue; |
19 } | 20 } |
20 | 21 |
21 namespace chromeos { | 22 namespace chromeos { |
22 | 23 |
23 // The NetworkConfigurationHandler class is used to create and configure | 24 // The NetworkConfigurationHandler class is used to create and configure |
24 // networks in ChromeOS. It mostly calls through to the Shill service API, and | 25 // networks in ChromeOS. It mostly calls through to the Shill service API, and |
(...skipping 11 matching lines...) Expand all Loading... |
36 // |error_callback|. When the operation succeeds, |callback| will be called, and | 37 // |error_callback|. When the operation succeeds, |callback| will be called, and |
37 // when it doesn't, |error_callback| will be called with information about the | 38 // when it doesn't, |error_callback| will be called with information about the |
38 // error, including a symbolic name for the error and often some error message | 39 // error, including a symbolic name for the error and often some error message |
39 // that is suitable for logging. None of the error message text is meant for | 40 // that is suitable for logging. None of the error message text is meant for |
40 // user consumption. | 41 // user consumption. |
41 | 42 |
42 class CHROMEOS_EXPORT NetworkConfigurationHandler { | 43 class CHROMEOS_EXPORT NetworkConfigurationHandler { |
43 public: | 44 public: |
44 ~NetworkConfigurationHandler(); | 45 ~NetworkConfigurationHandler(); |
45 | 46 |
46 // Sets the global instance. Must be called before any calls to Get(). | |
47 static void Initialize(); | |
48 | |
49 // Destroys the global instance. | |
50 static void Shutdown(); | |
51 | |
52 // Gets the global instance. Initialize() must be called first. | |
53 static NetworkConfigurationHandler* Get(); | |
54 | |
55 // Gets the properties of the network with id |service_path|. See note on | 47 // Gets the properties of the network with id |service_path|. See note on |
56 // |callback| and |error_callback|, in class description above. | 48 // |callback| and |error_callback|, in class description above. |
57 void GetProperties( | 49 void GetProperties( |
58 const std::string& service_path, | 50 const std::string& service_path, |
59 const network_handler::DictionaryResultCallback& callback, | 51 const network_handler::DictionaryResultCallback& callback, |
60 const network_handler::ErrorCallback& error_callback) const; | 52 const network_handler::ErrorCallback& error_callback) const; |
61 | 53 |
62 // Sets the properties of the network with id |service_path|. This means the | 54 // Sets the properties of the network with id |service_path|. This means the |
63 // given properties will be merged with the existing settings, and it won't | 55 // given properties will be merged with the existing settings, and it won't |
64 // clear any existing properties. See note on |callback| and |error_callback|, | 56 // clear any existing properties. See note on |callback| and |error_callback|, |
(...skipping 25 matching lines...) Expand all Loading... |
90 | 82 |
91 // Removes the network |service_path| from the remembered network list in the | 83 // Removes the network |service_path| from the remembered network list in the |
92 // active Shill profile. The network may still show up in the visible networks | 84 // active Shill profile. The network may still show up in the visible networks |
93 // after this, but no profile configuration will remain. See note on | 85 // after this, but no profile configuration will remain. See note on |
94 // |callback| and |error_callback|, in class description above. | 86 // |callback| and |error_callback|, in class description above. |
95 void RemoveConfiguration( | 87 void RemoveConfiguration( |
96 const std::string& service_path, | 88 const std::string& service_path, |
97 const base::Closure& callback, | 89 const base::Closure& callback, |
98 const network_handler::ErrorCallback& error_callback) const; | 90 const network_handler::ErrorCallback& error_callback) const; |
99 | 91 |
100 private: | 92 // Construct and initialize an instance for testing. |
| 93 static NetworkConfigurationHandler* InitializeForTest(); |
| 94 |
| 95 protected: |
| 96 friend class NetworkHandler; |
101 friend class NetworkConfigurationHandlerTest; | 97 friend class NetworkConfigurationHandlerTest; |
102 NetworkConfigurationHandler(); | 98 NetworkConfigurationHandler(); |
103 | 99 |
104 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationHandler); | 100 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationHandler); |
105 }; | 101 }; |
106 | 102 |
107 } // namespace chromeos | 103 } // namespace chromeos |
108 | 104 |
109 #endif // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ | 105 #endif // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ |
OLD | NEW |