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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 95 |
104 // Removes the network |service_path| from the remembered network list in the | 96 // Removes the network |service_path| from the remembered network list in the |
105 // active Shill profile. The network may still show up in the visible networks | 97 // active Shill profile. The network may still show up in the visible networks |
106 // after this, but no profile configuration will remain. See note on | 98 // after this, but no profile configuration will remain. See note on |
107 // |callback| and |error_callback|, in class description above. | 99 // |callback| and |error_callback|, in class description above. |
108 void RemoveConfiguration( | 100 void RemoveConfiguration( |
109 const std::string& service_path, | 101 const std::string& service_path, |
110 const base::Closure& callback, | 102 const base::Closure& callback, |
111 const network_handler::ErrorCallback& error_callback) const; | 103 const network_handler::ErrorCallback& error_callback) const; |
112 | 104 |
113 private: | 105 protected: |
| 106 friend class NetworkHandler; |
114 friend class NetworkConfigurationHandlerTest; | 107 friend class NetworkConfigurationHandlerTest; |
115 NetworkConfigurationHandler(); | 108 NetworkConfigurationHandler(); |
116 | 109 |
117 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationHandler); | 110 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationHandler); |
118 }; | 111 }; |
119 | 112 |
120 } // namespace chromeos | 113 } // namespace chromeos |
121 | 114 |
122 #endif // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ | 115 #endif // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ |
OLD | NEW |