[iOS] Use ChromeCoordinator's `isOffTheRecord` property.

Simplify code by using `self.isOffTheRecord` where appropriate.

This CL was uploaded by git cl split.

R=sczs@chromium.org

Bug: 401523912
Change-Id: I1eb660f4b48f1d126c88ee366f5a338a6d1702bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6469642
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Auto-Submit: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448931}
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm
index 061b126..9034c914 100644
--- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm
+++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm
@@ -310,7 +310,7 @@
   [sceneState addObserver:self];
 
   // Configures incognito NTP if user is in incognito mode.
-  if (self.profile->IsOffTheRecord()) {
+  if (self.isOffTheRecord) {
     DCHECK(!self.incognitoViewController);
     UrlLoadingBrowserAgent* URLLoader =
         UrlLoadingBrowserAgent::FromBrowser(self.browser);
@@ -374,7 +374,7 @@
   SceneState* sceneState = self.browser->GetSceneState();
   [sceneState removeObserver:self];
 
-  if (self.profile->IsOffTheRecord()) {
+  if (self.isOffTheRecord) {
     self.incognitoViewController = nil;
     self.started = NO;
     return;
@@ -483,7 +483,7 @@
 }
 
 - (void)reload {
-  if (self.profile->IsOffTheRecord()) {
+  if (self.isOffTheRecord) {
     return;
   }
   [self.contentSuggestionsCoordinator refresh];
@@ -508,7 +508,7 @@
 }
 
 - (void)constrainNamedGuideForFeedIPH {
-  if (self.profile->IsOffTheRecord()) {
+  if (self.isOffTheRecord) {
     return;
   }
   [LayoutGuideCenterForBrowser(self.browser)
@@ -551,7 +551,7 @@
 }
 
 - (BOOL)isFakeboxPinned {
-  if (self.profile->IsOffTheRecord()) {
+  if (self.isOffTheRecord) {
     return YES;
   }
   return self.NTPViewController.isFakeboxPinned;
@@ -827,7 +827,7 @@
 
 - (UIViewController*)viewController {
   DCHECK(self.started);
-  if (self.profile->IsOffTheRecord()) {
+  if (self.isOffTheRecord) {
     return self.incognitoViewController;
   } else {
     return self.containerViewController;
@@ -1680,7 +1680,7 @@
   self.visible = visible;
   self.NTPViewController.NTPVisible = visible;
 
-  if (!self.profile->IsOffTheRecord()) {
+  if (!self.isOffTheRecord) {
     if (visible) {
       self.didAppearTime = base::TimeTicks::Now();
 
diff --git a/ios/chrome/browser/toolbar/ui_bundled/adaptive_toolbar_coordinator.mm b/ios/chrome/browser/toolbar/ui_bundled/adaptive_toolbar_coordinator.mm
index 5b5a88e..fbc15e7 100644
--- a/ios/chrome/browser/toolbar/ui_bundled/adaptive_toolbar_coordinator.mm
+++ b/ios/chrome/browser/toolbar/ui_bundled/adaptive_toolbar_coordinator.mm
@@ -116,7 +116,7 @@
 
 - (void)updateToolbarForSideSwipeSnapshot:(web::WebState*)webState {
   BOOL isNonIncognitoNTP =
-      !self.profile->IsOffTheRecord() && IsVisibleURLNewTabPage(webState);
+      !self.isOffTheRecord && IsVisibleURLNewTabPage(webState);
 
   [self.mediator updateConsumerForWebState:webState];
   [self.viewController updateForSideSwipeSnapshot:isNonIncognitoNTP];
@@ -179,7 +179,7 @@
 #pragma mark - Protected
 
 - (ToolbarButtonFactory*)buttonFactoryWithType:(ToolbarType)type {
-  BOOL isIncognito = self.profile->IsOffTheRecord();
+  BOOL isIncognito = self.isOffTheRecord;
   ToolbarStyle style =
       isIncognito ? ToolbarStyle::kIncognito : ToolbarStyle::kNormal;
 
diff --git a/ios/chrome/browser/toolbar/ui_bundled/primary_toolbar_coordinator.mm b/ios/chrome/browser/toolbar/ui_bundled/primary_toolbar_coordinator.mm
index 83e2ffbd..769fde6 100644
--- a/ios/chrome/browser/toolbar/ui_bundled/primary_toolbar_coordinator.mm
+++ b/ios/chrome/browser/toolbar/ui_bundled/primary_toolbar_coordinator.mm
@@ -59,7 +59,7 @@
 
   CommandDispatcher* dispatcher = self.browser->GetCommandDispatcher();
 
-  BOOL isOffTheRecord = self.profile->IsOffTheRecord();
+  BOOL isOffTheRecord = self.isOffTheRecord;
 
   self.viewController = [[PrimaryToolbarViewController alloc] init];
   self.viewController.shouldHideOmniboxOnNTP = !isOffTheRecord;
@@ -143,7 +143,7 @@
 
 // Returns the active banner promo app agent if it is available currently.
 - (DefaultBrowserBannerPromoAppAgent*)activeBannerPromoAppAgent {
-  if (self.profile->IsOffTheRecord()) {
+  if (self.isOffTheRecord) {
     return nil;
   }
 
diff --git a/ios/chrome/browser/toolbar/ui_bundled/toolbar_coordinator.mm b/ios/chrome/browser/toolbar/ui_bundled/toolbar_coordinator.mm
index f3686166..1832b39a 100644
--- a/ios/chrome/browser/toolbar/ui_bundled/toolbar_coordinator.mm
+++ b/ios/chrome/browser/toolbar/ui_bundled/toolbar_coordinator.mm
@@ -263,7 +263,7 @@
   // IsActive() value rather than checking -IsVisibleURLNewTabPage.
   NewTabPageTabHelper* NTPHelper = NewTabPageTabHelper::FromWebState(webState);
   BOOL isNTP = NTPHelper && NTPHelper->IsActive();
-  BOOL isOffTheRecord = self.profile->IsOffTheRecord();
+  BOOL isOffTheRecord = self.isOffTheRecord;
   BOOL canShowTabStrip = IsRegularXRegularSizeClass(self.traitEnvironment);
 
   // Hide the toolbar when displaying content suggestions without the tab
@@ -611,8 +611,7 @@
 /// an incognito browser, the NTP is displayed, and whether the fakebox was
 /// pinned if it was selected.
 - (OmniboxFocusTrigger)omniboxFocusTrigger {
-  if (self.profile->IsOffTheRecord() ||
-      !IsSplitToolbarMode(self.traitEnvironment)) {
+  if (self.isOffTheRecord || !IsSplitToolbarMode(self.traitEnvironment)) {
     return _focusedFromFakebox ? OmniboxFocusTrigger::kUnpinnedFakebox
                                : OmniboxFocusTrigger::kOther;
   }