| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ios/chrome/browser/ui/authentication/authentication_ui_util.h" | 5 #import "ios/chrome/browser/ui/authentication/authentication_ui_util.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "components/strings/grit/components_strings.h" | 9 #include "components/strings/grit/components_strings.h" |
| 10 #include "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" | 10 #include "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" |
| 11 #include "ios/chrome/grit/ios_strings.h" | 11 #include "ios/chrome/grit/ios_strings.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
| 14 namespace ios_internal { | 18 namespace ios_internal { |
| 15 | 19 |
| 16 AlertCoordinator* ErrorCoordinator(NSError* error, | 20 AlertCoordinator* ErrorCoordinator(NSError* error, |
| 17 ProceduralBlock dismissAction, | 21 ProceduralBlock dismissAction, |
| 18 UIViewController* viewController) { | 22 UIViewController* viewController) { |
| 19 DCHECK(error); | 23 DCHECK(error); |
| 20 | 24 |
| 21 AlertCoordinator* alertCoordinator = | 25 AlertCoordinator* alertCoordinator = |
| 22 ErrorCoordinatorNoItem(error, viewController); | 26 ErrorCoordinatorNoItem(error, viewController); |
| 23 | 27 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 l10n_util::GetNSString(IDS_IOS_SYNC_ERROR_INTERNET_DISCONNECTED); | 48 l10n_util::GetNSString(IDS_IOS_SYNC_ERROR_INTERNET_DISCONNECTED); |
| 45 } else if ([error.userInfo objectForKey:NSLocalizedDescriptionKey]) { | 49 } else if ([error.userInfo objectForKey:NSLocalizedDescriptionKey]) { |
| 46 errorMessage = [NSString stringWithFormat:@"%@ (%@ %" PRIdNS ")", | 50 errorMessage = [NSString stringWithFormat:@"%@ (%@ %" PRIdNS ")", |
| 47 error.localizedDescription, | 51 error.localizedDescription, |
| 48 error.domain, error.code]; | 52 error.domain, error.code]; |
| 49 } else { | 53 } else { |
| 50 // If the error has no NSLocalizedDescriptionKey in its user info, then | 54 // If the error has no NSLocalizedDescriptionKey in its user info, then |
| 51 // |error.localizedDescription| contains the error domain and code. | 55 // |error.localizedDescription| contains the error domain and code. |
| 52 errorMessage = error.localizedDescription; | 56 errorMessage = error.localizedDescription; |
| 53 } | 57 } |
| 54 AlertCoordinator* alertCoordinator = [[[AlertCoordinator alloc] | 58 AlertCoordinator* alertCoordinator = |
| 55 initWithBaseViewController:viewController | 59 [[AlertCoordinator alloc] initWithBaseViewController:viewController |
| 56 title:title | 60 title:title |
| 57 message:errorMessage] autorelease]; | 61 message:errorMessage]; |
| 58 return alertCoordinator; | 62 return alertCoordinator; |
| 59 } | 63 } |
| 60 | 64 |
| 61 } // namespace ios_internal | 65 } // namespace ios_internal |
| OLD | NEW |