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 #include "chromeos/network/network_handler_callbacks.h" | 5 #include "chromeos/network/network_handler_callbacks.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/values.h" | 10 #include "base/values.h" |
9 #include "components/device_event_log/device_event_log.h" | 11 #include "components/device_event_log/device_event_log.h" |
10 | 12 |
11 namespace { | 13 namespace { |
12 | 14 |
13 bool SuppressError(const std::string& dbus_error_message) { | 15 bool SuppressError(const std::string& dbus_error_message) { |
14 if (dbus_error_message == "Wake on WiFi not supported") | 16 if (dbus_error_message == "Wake on WiFi not supported") |
15 return true; | 17 return true; |
16 return false; | 18 return false; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 detail += ": " + dbus_error_message; | 80 detail += ": " + dbus_error_message; |
79 device_event_log::LogLevel log_level = | 81 device_event_log::LogLevel log_level = |
80 SuppressError(dbus_error_message) ? device_event_log::LOG_LEVEL_DEBUG | 82 SuppressError(dbus_error_message) ? device_event_log::LOG_LEVEL_DEBUG |
81 : device_event_log::LOG_LEVEL_ERROR; | 83 : device_event_log::LOG_LEVEL_ERROR; |
82 DEVICE_LOG(::device_event_log::LOG_TYPE_NETWORK, log_level) << detail; | 84 DEVICE_LOG(::device_event_log::LOG_TYPE_NETWORK, log_level) << detail; |
83 | 85 |
84 if (error_callback.is_null()) | 86 if (error_callback.is_null()) |
85 return; | 87 return; |
86 scoped_ptr<base::DictionaryValue> error_data(CreateDBusErrorData( | 88 scoped_ptr<base::DictionaryValue> error_data(CreateDBusErrorData( |
87 path, error_name, detail, dbus_error_name, dbus_error_message)); | 89 path, error_name, detail, dbus_error_name, dbus_error_message)); |
88 error_callback.Run(error_name, error_data.Pass()); | 90 error_callback.Run(error_name, std::move(error_data)); |
89 } | 91 } |
90 | 92 |
91 void GetPropertiesCallback(const DictionaryResultCallback& callback, | 93 void GetPropertiesCallback(const DictionaryResultCallback& callback, |
92 const ErrorCallback& error_callback, | 94 const ErrorCallback& error_callback, |
93 const std::string& path, | 95 const std::string& path, |
94 DBusMethodCallStatus call_status, | 96 DBusMethodCallStatus call_status, |
95 const base::DictionaryValue& value) { | 97 const base::DictionaryValue& value) { |
96 if (call_status != DBUS_METHOD_CALL_SUCCESS) { | 98 if (call_status != DBUS_METHOD_CALL_SUCCESS) { |
97 NET_LOG(ERROR) << "GetProperties failed: " << path | 99 NET_LOG(ERROR) << "GetProperties failed: " << path |
98 << " Status: " << call_status; | 100 << " Status: " << call_status; |
99 RunErrorCallback( | 101 RunErrorCallback( |
100 error_callback, path, kDBusFailedError, kDBusFailedErrorMessage); | 102 error_callback, path, kDBusFailedError, kDBusFailedErrorMessage); |
101 } else if (!callback.is_null()) { | 103 } else if (!callback.is_null()) { |
102 callback.Run(path, value); | 104 callback.Run(path, value); |
103 } | 105 } |
104 } | 106 } |
105 | 107 |
106 } // namespace network_handler | 108 } // namespace network_handler |
107 } // namespace chromeos | 109 } // namespace chromeos |
OLD | NEW |