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_HANDLER_CALLBACKS_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_HANDLER_CALLBACKS_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_HANDLER_CALLBACKS_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_HANDLER_CALLBACKS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "chromeos/chromeos_export.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class DictionaryValue; | 15 class DictionaryValue; |
15 } | 16 } |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 namespace network_handler { | 19 namespace network_handler { |
19 | 20 |
20 // An error callback used by both the configuration handler and the state | 21 // An error callback used by both the configuration handler and the state |
21 // handler to receive error results from the API. | 22 // handler to receive error results from the API. |
22 typedef base::Callback< | 23 typedef base::Callback< |
23 void(const std::string& error_name, | 24 void(const std::string& error_name, |
24 const scoped_ptr<base::DictionaryValue> error_data)> ErrorCallback; | 25 const scoped_ptr<base::DictionaryValue> error_data)> ErrorCallback; |
25 | 26 |
26 typedef base::Callback< | 27 typedef base::Callback< |
27 void(const std::string& service_path, | 28 void(const std::string& service_path, |
28 const base::DictionaryValue& dictionary)> DictionaryResultCallback; | 29 const base::DictionaryValue& dictionary)> DictionaryResultCallback; |
29 | 30 |
30 typedef base::Callback< | 31 typedef base::Callback< |
31 void(const std::string& service_path)> StringResultCallback; | 32 void(const std::string& service_path)> StringResultCallback; |
32 | 33 |
33 // Create a DictionaryValue for passing to ErrorCallback | 34 // Create a DictionaryValue for passing to ErrorCallback |
34 base::DictionaryValue* CreateErrorData(const std::string& service_path, | 35 CHROMEOS_EXPORT base::DictionaryValue* CreateErrorData( |
35 const std::string& error_name, | 36 const std::string& service_path, |
36 const std::string& error_message); | 37 const std::string& error_name, |
| 38 const std::string& error_message); |
37 | 39 |
38 // Callback for Shill errors. |path| may be blank if not relevant. | 40 // Callback for Shill errors. |path| may be blank if not relevant. |
39 // Logs an error and calls |error_callback| if not null. | 41 // Logs an error and calls |error_callback| if not null. |
40 void ShillErrorCallbackFunction(const std::string& module, | 42 void ShillErrorCallbackFunction(const std::string& module, |
41 const std::string& path, | 43 const std::string& path, |
42 const ErrorCallback& error_callback, | 44 const ErrorCallback& error_callback, |
43 const std::string& error_name, | 45 const std::string& error_name, |
44 const std::string& error_message); | 46 const std::string& error_message); |
45 | 47 |
46 } // namespace network_handler | 48 } // namespace network_handler |
47 } // namespace chromeos | 49 } // namespace chromeos |
48 | 50 |
49 #endif // CHROMEOS_NETWORK_NETWORK_HANDLER_CALLBACKS_H_ | 51 #endif // CHROMEOS_NETWORK_NETWORK_HANDLER_CALLBACKS_H_ |
OLD | NEW |