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_callbacks.h" | 15 #include "chromeos/network/network_handler_callbacks.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class DictionaryValue; | 18 class DictionaryValue; |
19 } | 19 } |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 | 22 |
23 // The NetworkConfigurationHandler class is used to create and configure | 23 // The NetworkConfigurationHandler class is used to create and configure |
24 // networks in ChromeOS. It mostly calls through to the Shill service API, and | 24 // networks in ChromeOS. It mostly calls through to the Shill service API, and |
25 // most calls are asynchronous for that reason. No calls will block on DBus | 25 // most calls are asynchronous for that reason. No calls will block on DBus |
26 // calls. | 26 // calls. |
27 // | 27 // |
28 // This is owned and it's lifetime managed by aura::Shell. | 28 // This is owned and it's lifetime managed by the Chrome startup code. It's |
| 29 // basically a singleton, but with explicit lifetime management. |
29 // | 30 // |
30 // For accessing lists of remembered networks, and other state information, see | 31 // For accessing lists of remembered networks, and other state information, see |
31 // the class NetworkStateHandler. | 32 // the class NetworkStateHandler. |
32 // | 33 // |
33 // Note on callbacks: Because all the functions here are meant to be | 34 // Note on callbacks: Because all the functions here are meant to be |
34 // asynchronous, they all take a |callback| of some type, and an | 35 // asynchronous, they all take a |callback| of some type, and an |
35 // |error_callback|. When the operation succeeds, |callback| will be called, and | 36 // |error_callback|. When the operation succeeds, |callback| will be called, and |
36 // when it doesn't, |error_callback| will be called with information about the | 37 // when it doesn't, |error_callback| will be called with information about the |
37 // error, including a symbolic name for the error and often some error message | 38 // error, including a symbolic name for the error and often some error message |
38 // that is suitable for logging. None of the error message text is meant for | 39 // that is suitable for logging. None of the error message text is meant for |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const network_handler::ErrorCallback& error_callback) const; | 87 const network_handler::ErrorCallback& error_callback) const; |
87 | 88 |
88 // Initiates a disconnect with the network at |service_path|. See note on | 89 // Initiates a disconnect with the network at |service_path|. See note on |
89 // |callback| and |error_callback|, in class description above. | 90 // |callback| and |error_callback|, in class description above. |
90 void Disconnect(const std::string& service_path, | 91 void Disconnect(const std::string& service_path, |
91 const base::Closure& callback, | 92 const base::Closure& callback, |
92 const network_handler::ErrorCallback& error_callback) const; | 93 const network_handler::ErrorCallback& error_callback) const; |
93 | 94 |
94 | 95 |
95 // Creates a network with the given properties in the active Shill profile, | 96 // Creates a network with the given properties in the active Shill profile, |
96 // and returns the properties to |callback| if successful, along with the new | 97 // and returns the new service_path to |callback| if successful. See note on |
97 // service_path. See note on |callback| and |error_callback|, in class | 98 // |callback| and |error_callback|, in class description above. |
98 // description above. | |
99 void CreateConfiguration( | 99 void CreateConfiguration( |
100 const base::DictionaryValue& properties, | 100 const base::DictionaryValue& properties, |
101 const network_handler::StringResultCallback& callback, | 101 const network_handler::StringResultCallback& callback, |
102 const network_handler::ErrorCallback& error_callback) const; | 102 const network_handler::ErrorCallback& error_callback) const; |
103 | 103 |
104 // Removes the network |service_path| from the remembered network list in the | 104 // 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 | 105 // 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 | 106 // after this, but no profile configuration will remain. See note on |
107 // |callback| and |error_callback|, in class description above. | 107 // |callback| and |error_callback|, in class description above. |
108 void RemoveConfiguration( | 108 void RemoveConfiguration( |
109 const std::string& service_path, | 109 const std::string& service_path, |
110 const base::Closure& callback, | 110 const base::Closure& callback, |
111 const network_handler::ErrorCallback& error_callback) const; | 111 const network_handler::ErrorCallback& error_callback) const; |
112 | 112 |
113 private: | 113 private: |
114 friend class NetworkConfigurationHandlerTest; | 114 friend class NetworkConfigurationHandlerTest; |
115 NetworkConfigurationHandler(); | 115 NetworkConfigurationHandler(); |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationHandler); | 117 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationHandler); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace chromeos | 120 } // namespace chromeos |
121 | 121 |
122 #endif // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ | 122 #endif // CHROMEOS_NETWORK_NETWORK_CONFIGURATION_HANDLER_H_ |
OLD | NEW |