OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sad_tab/sad_tab_view.h" | 5 #import "ios/chrome/browser/ui/sad_tab/sad_tab_view.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "components/grit/components_scaled_resources.h" | 9 #include "components/grit/components_scaled_resources.h" |
10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
11 #include "components/ui_metrics/sadtab_metrics_types.h" | 11 #include "components/ui_metrics/sadtab_metrics_types.h" |
12 #include "ios/chrome/browser/chrome_url_constants.h" | 12 #include "ios/chrome/browser/chrome_url_constants.h" |
13 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" | 13 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" |
14 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 14 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
15 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" | 15 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" |
16 #import "ios/chrome/browser/ui/commands/open_url_command.h" | 16 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
17 #include "ios/chrome/browser/ui/rtl_geometry.h" | 17 #include "ios/chrome/browser/ui/rtl_geometry.h" |
18 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 18 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
19 #import "ios/chrome/browser/ui/url_loader.h" | 19 #import "ios/chrome/browser/ui/url_loader.h" |
20 #import "ios/chrome/browser/ui/util/label_link_controller.h" | 20 #import "ios/chrome/browser/ui/util/label_link_controller.h" |
21 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate rialButtons.h" | 21 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate rialButtons.h" |
22 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" | 22 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" |
23 #include "ios/web/public/browser_state.h" | |
23 #include "ios/web/public/navigation_manager.h" | 24 #include "ios/web/public/navigation_manager.h" |
24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
26 | 27 |
27 #if !defined(__has_feature) || !__has_feature(objc_arc) | 28 #if !defined(__has_feature) || !__has_feature(objc_arc) |
28 #error "This file requires ARC support." | 29 #error "This file requires ARC support." |
29 #endif | 30 #endif |
30 | 31 |
31 namespace { | 32 namespace { |
32 // Color constants. | 33 // Color constants. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 label = [[NSAttributedString alloc] | 234 label = [[NSAttributedString alloc] |
234 initWithString:l10n_util::GetNSString(IDS_SAD_TAB_MESSAGE)]; | 235 initWithString:l10n_util::GetNSString(IDS_SAD_TAB_MESSAGE)]; |
235 break; | 236 break; |
236 case SadTabViewMode::FEEDBACK: { | 237 case SadTabViewMode::FEEDBACK: { |
237 NSString* feedbackIntroductionString = [NSString | 238 NSString* feedbackIntroductionString = [NSString |
238 stringWithFormat:@"%@\n\n", | 239 stringWithFormat:@"%@\n\n", |
239 l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_TRY)]; | 240 l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_TRY)]; |
240 NSMutableAttributedString* feedbackString = | 241 NSMutableAttributedString* feedbackString = |
241 [[NSMutableAttributedString alloc] | 242 [[NSMutableAttributedString alloc] |
242 initWithString:feedbackIntroductionString]; | 243 initWithString:feedbackIntroductionString]; |
244 | |
245 BOOL isAlreadyInIncognitoMode = | |
246 _navigationManager->GetBrowserState()->IsOffTheRecord(); | |
247 NSMutableArray* stringsArray = [NSMutableArray | |
248 arrayWithObjects:l10n_util::GetNSString( | |
249 IDS_SAD_TAB_RELOAD_CLOSE_NOTABS), | |
250 l10n_util::GetNSString( | |
251 IDS_SAD_TAB_RELOAD_RESTART_BROWSER), | |
252 l10n_util::GetNSString( | |
253 IDS_SAD_TAB_RELOAD_RESTART_DEVICE), | |
254 nil]; | |
kkhorimoto
2017/06/22 00:33:31
I think the formatting here would be much better i
PL
2017/06/22 15:15:38
I agree, but unfortunately I am not able to make m
kkhorimoto
2017/06/22 18:20:10
[@[] mutableCopy], or [NSMutableArray arrayWithArr
| |
255 if (!isAlreadyInIncognitoMode) { | |
256 [stringsArray | |
257 insertObject:l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_INCOGNITO) | |
kkhorimoto
2017/06/22 00:33:31
Maybe declare the string on a separate line to hel
PL
2017/06/22 15:15:38
Done! Thanks!
kkhorimoto
2017/06/22 18:20:10
You said Done, but there's no new patch :)
| |
258 atIndex:1]; | |
259 } | |
260 | |
243 NSAttributedString* bulletedListString = | 261 NSAttributedString* bulletedListString = |
244 [[self class] bulletedAttributedStringFromStrings:@[ | 262 [[self class] bulletedAttributedStringFromStrings:stringsArray]; |
245 l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_CLOSE_NOTABS), | |
246 l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_INCOGNITO), | |
247 l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_RESTART_BROWSER), | |
248 l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_RESTART_DEVICE) | |
249 ]]; | |
250 [feedbackString appendAttributedString:bulletedListString]; | 263 [feedbackString appendAttributedString:bulletedListString]; |
251 label = feedbackString; | 264 label = feedbackString; |
252 break; | 265 break; |
253 } | 266 } |
254 } | 267 } |
255 DCHECK(label); | 268 DCHECK(label); |
256 return label; | 269 return label; |
257 } | 270 } |
258 | 271 |
259 - (nonnull NSString*)footerLabelText { | 272 - (nonnull NSString*)footerLabelText { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 break; | 586 break; |
574 } | 587 } |
575 }; | 588 }; |
576 } | 589 } |
577 | 590 |
578 + (UIColor*)sadTabBackgroundColor { | 591 + (UIColor*)sadTabBackgroundColor { |
579 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; | 592 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; |
580 } | 593 } |
581 | 594 |
582 @end | 595 @end |
OLD | NEW |