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

Unified Diff: ios/chrome/browser/ui/sad_tab/sad_tab_view.mm

Issue 2949833005: Remove incognito advice from Sad Tab if already incognito (Closed)
Patch Set: Protect against a case under unit testing where navigationManager could be nil Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/sad_tab/sad_tab_view.mm
diff --git a/ios/chrome/browser/ui/sad_tab/sad_tab_view.mm b/ios/chrome/browser/ui/sad_tab/sad_tab_view.mm
index cad5607e7b3df0f3f05a5de7e7d9043144ea9b06..588f32e071e5ee7aecb42e536d6e8b5a06aad33f 100644
--- a/ios/chrome/browser/ui/sad_tab/sad_tab_view.mm
+++ b/ios/chrome/browser/ui/sad_tab/sad_tab_view.mm
@@ -20,6 +20,7 @@
#import "ios/chrome/browser/ui/util/label_link_controller.h"
#import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
+#include "ios/web/public/browser_state.h"
#include "ios/web/public/navigation_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
@@ -240,12 +241,25 @@ NSString* const kMessageTextViewBulletRTLFormat = @"\u202E%@\u202C";
NSMutableAttributedString* feedbackString =
[[NSMutableAttributedString alloc]
initWithString:feedbackIntroductionString];
+
+ BOOL isAlreadyInIncognitoMode =
+ _navigationManager
+ ? _navigationManager->GetBrowserState()->IsOffTheRecord()
+ : NO;
+ NSMutableArray* stringsArray = [NSMutableArray
+ arrayWithObjects:l10n_util::GetNSString(
+ IDS_SAD_TAB_RELOAD_RESTART_BROWSER),
+ l10n_util::GetNSString(
+ IDS_SAD_TAB_RELOAD_RESTART_DEVICE),
+ nil];
+ if (!isAlreadyInIncognitoMode) {
+ NSString* incognitoSuggestionString =
+ l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_INCOGNITO);
+ [stringsArray insertObject:incognitoSuggestionString atIndex:0];
+ }
+
NSAttributedString* bulletedListString =
- [[self class] bulletedAttributedStringFromStrings:@[
- l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_INCOGNITO),
- l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_RESTART_BROWSER),
- l10n_util::GetNSString(IDS_SAD_TAB_RELOAD_RESTART_DEVICE)
- ]];
+ [[self class] bulletedAttributedStringFromStrings:stringsArray];
[feedbackString appendAttributedString:bulletedListString];
label = feedbackString;
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698