Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: ash/system/chromeos/network/network_state_notifier.cc

Issue 23522050: Provide Shill Error to failure notification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ash/system/chromeos/network/network_state_notifier.h" 5 #include "ash/system/chromeos/network/network_state_notifier.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/chromeos/network/network_connect.h" 8 #include "ash/system/chromeos/network/network_connect.h"
9 #include "ash/system/system_notifier.h" 9 #include "ash/system/system_notifier.h"
10 #include "ash/system/tray/system_tray_delegate.h" 10 #include "ash/system/tray/system_tray_delegate.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 l10n_util::GetStringFUTF16(IDS_NETWORK_CELLULAR_ACTIVATED, 189 l10n_util::GetStringFUTF16(IDS_NETWORK_CELLULAR_ACTIVATED,
190 UTF8ToUTF16((cellular->name()))), 190 UTF8ToUTF16((cellular->name()))),
191 icon, 191 icon,
192 system_notifier::NOTIFIER_NETWORK, 192 system_notifier::NOTIFIER_NETWORK,
193 base::Bind(&ash::network_connect::ShowNetworkSettings, 193 base::Bind(&ash::network_connect::ShowNetworkSettings,
194 cellular->path()))); 194 cellular->path())));
195 } 195 }
196 196
197 void NetworkStateNotifier::ShowNetworkConnectError( 197 void NetworkStateNotifier::ShowNetworkConnectError(
198 const std::string& error_name, 198 const std::string& error_name,
199 const std::string& shill_error,
199 const std::string& service_path) { 200 const std::string& service_path) {
200 if (service_path.empty()) { 201 if (service_path.empty()) {
201 base::DictionaryValue shill_properties; 202 base::DictionaryValue shill_properties;
202 ShowConnectErrorNotification(error_name, service_path, shill_properties); 203 ShowConnectErrorNotification(error_name, shill_error, service_path,
204 shill_properties);
203 return; 205 return;
204 } 206 }
205 // Get the up-to-date properties for the network and display the error. 207 // Get the up-to-date properties for the network and display the error.
206 NetworkHandler::Get()->network_configuration_handler()->GetProperties( 208 NetworkHandler::Get()->network_configuration_handler()->GetProperties(
207 service_path, 209 service_path,
208 base::Bind(&NetworkStateNotifier::ConnectErrorPropertiesSucceeded, 210 base::Bind(&NetworkStateNotifier::ConnectErrorPropertiesSucceeded,
209 weak_ptr_factory_.GetWeakPtr(), error_name), 211 weak_ptr_factory_.GetWeakPtr(), error_name, shill_error),
210 base::Bind(&NetworkStateNotifier::ConnectErrorPropertiesFailed, 212 base::Bind(&NetworkStateNotifier::ConnectErrorPropertiesFailed,
211 weak_ptr_factory_.GetWeakPtr(), error_name, service_path)); 213 weak_ptr_factory_.GetWeakPtr(), error_name, shill_error,
214 service_path));
212 } 215 }
213 216
214 void NetworkStateNotifier::ConnectErrorPropertiesSucceeded( 217 void NetworkStateNotifier::ConnectErrorPropertiesSucceeded(
215 const std::string& error_name, 218 const std::string& error_name,
219 const std::string& shill_error,
216 const std::string& service_path, 220 const std::string& service_path,
217 const base::DictionaryValue& shill_properties) { 221 const base::DictionaryValue& shill_properties) {
218 ShowConnectErrorNotification(error_name, service_path, shill_properties); 222 ShowConnectErrorNotification(error_name, shill_error, service_path,
223 shill_properties);
219 } 224 }
220 225
221 void NetworkStateNotifier::ConnectErrorPropertiesFailed( 226 void NetworkStateNotifier::ConnectErrorPropertiesFailed(
222 const std::string& error_name, 227 const std::string& error_name,
228 const std::string& shill_error,
223 const std::string& service_path, 229 const std::string& service_path,
224 const std::string& shill_error_name, 230 const std::string& shill_connect_error,
225 scoped_ptr<base::DictionaryValue> shill_error_data) { 231 scoped_ptr<base::DictionaryValue> shill_error_data) {
226 base::DictionaryValue shill_properties; 232 base::DictionaryValue shill_properties;
227 ShowConnectErrorNotification(error_name, service_path, shill_properties); 233 ShowConnectErrorNotification(error_name, shill_error, service_path,
234 shill_properties);
228 } 235 }
229 236
230 void NetworkStateNotifier::ShowConnectErrorNotification( 237 void NetworkStateNotifier::ShowConnectErrorNotification(
231 const std::string& error_name, 238 const std::string& error_name,
239 const std::string& shill_error,
232 const std::string& service_path, 240 const std::string& service_path,
233 const base::DictionaryValue& shill_properties) { 241 const base::DictionaryValue& shill_properties) {
234 string16 error = GetConnectErrorString(error_name); 242 string16 error = GetConnectErrorString(error_name);
235 if (error.empty()) { 243 if (error.empty()) {
236 std::string network_error; 244 // Service.Error gets cleared shortly after State transitions to Failure,
237 shill_properties.GetStringWithoutPathExpansion( 245 // so rely on |shill_error| unless empty.
238 flimflam::kErrorProperty, &network_error); 246 std::string network_error = shill_error;
247 if (network_error.empty()) {
248 shill_properties.GetStringWithoutPathExpansion(
249 flimflam::kErrorProperty, &network_error);
250 }
239 error = network_connect::ErrorString(network_error); 251 error = network_connect::ErrorString(network_error);
240 if (error.empty()) 252 if (error.empty())
241 error = l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN); 253 error = l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN);
242 } 254 }
243 NET_LOG_ERROR("Connect error notification: " + UTF16ToUTF8(error), 255 NET_LOG_ERROR("Connect error notification: " + UTF16ToUTF8(error),
244 service_path); 256 service_path);
245 257
246 std::string network_name = 258 std::string network_name =
247 chromeos::shill_property_util::GetNameFromProperties(service_path, 259 chromeos::shill_property_util::GetNameFromProperties(service_path,
248 shill_properties); 260 shill_properties);
(...skipping 23 matching lines...) Expand all
272 284
273 ShowErrorNotification( 285 ShowErrorNotification(
274 network_connect::kNetworkConnectNotificationId, 286 network_connect::kNetworkConnectNotificationId,
275 network_type, 287 network_type,
276 l10n_util::GetStringUTF16(IDS_NETWORK_CONNECTION_ERROR_TITLE), 288 l10n_util::GetStringUTF16(IDS_NETWORK_CONNECTION_ERROR_TITLE),
277 error_msg, 289 error_msg,
278 base::Bind(&network_connect::ShowNetworkSettings, service_path)); 290 base::Bind(&network_connect::ShowNetworkSettings, service_path));
279 } 291 }
280 292
281 } // namespace ash 293 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/network/network_state_notifier.h ('k') | chromeos/network/network_connection_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698