Commit 83109f7c authored by stkhapugin@chromium.org's avatar stkhapugin@chromium.org Committed by Commit Bot

Use same special handling for NTP location bar in non-incognito.

Show a fake placeholder and hide the share button on the non-incognito
new tab page.

Bug: None
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I1502112b15c60ad1f0844c71baa9461d87192423
Reviewed-on: https://chromium-review.googlesource.com/1115128Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570838}
parent 35d36f4c
...@@ -282,7 +282,7 @@ const int kLocationAuthorizationStatusCount = 4; ...@@ -282,7 +282,7 @@ const int kLocationAuthorizationStatusCount = 4;
- (void)updateLocationText:(NSString*)text { - (void)updateLocationText:(NSString*)text {
[self.omniboxCoordinator updateOmniboxState]; [self.omniboxCoordinator updateOmniboxState];
[self.viewController updateLocationText:text]; [self.viewController updateLocationText:text];
[self.viewController updateForIncognitoNTP:NO]; [self.viewController updateForNTP:NO];
} }
- (void)defocusOmnibox { - (void)defocusOmnibox {
...@@ -294,10 +294,7 @@ const int kLocationAuthorizationStatusCount = 4; ...@@ -294,10 +294,7 @@ const int kLocationAuthorizationStatusCount = 4;
} }
- (void)updateAfterNavigatingToNTP { - (void)updateAfterNavigatingToNTP {
BOOL isIncognito = self.browserState->IsOffTheRecord(); [self.viewController updateForNTP:YES];
if (isIncognito) {
[self.viewController updateForIncognitoNTP:YES];
}
} }
#pragma mark - private #pragma mark - private
......
...@@ -57,9 +57,9 @@ ...@@ -57,9 +57,9 @@
// Updates the location text in the non-editing mode. // Updates the location text in the non-editing mode.
- (void)updateLocationText:(NSString*)text; - (void)updateLocationText:(NSString*)text;
// Updates the location view to show a fake placeholder in the steady location // Updates the location view to show a fake placeholder in the steady location
// view and hides the trailing button if |isIncognitoNTP|. Otherwise, shows the // view and hides the trailing button if |isNTP|. Otherwise, shows the
// location text and the button as normal. // location text and the button as normal.
- (void)updateForIncognitoNTP:(BOOL)isIncognitoNTP; - (void)updateForNTP:(BOOL)isNTP;
// Displays the voice search button instead of the share button in steady state, // Displays the voice search button instead of the share button in steady state,
// and adds the voice search button to the empty textfield. // and adds the voice search button to the empty textfield.
......
...@@ -201,8 +201,8 @@ typedef NS_ENUM(int, TrailingButtonState) { ...@@ -201,8 +201,8 @@ typedef NS_ENUM(int, TrailingButtonState) {
[icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; [icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]];
} }
- (void)updateForIncognitoNTP:(BOOL)isIncognitoNTP { - (void)updateForNTP:(BOOL)isNTP {
if (isIncognitoNTP) { if (isNTP) {
// Display a fake "placeholder". // Display a fake "placeholder".
NSString* placeholderString = NSString* placeholderString =
l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT); l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT);
...@@ -213,7 +213,7 @@ typedef NS_ENUM(int, TrailingButtonState) { ...@@ -213,7 +213,7 @@ typedef NS_ENUM(int, TrailingButtonState) {
initWithString:placeholderString initWithString:placeholderString
attributes:@{NSForegroundColorAttributeName : placeholderColor}]; attributes:@{NSForegroundColorAttributeName : placeholderColor}];
} }
self.hideShareButtonWhileOnIncognitoNTP = isIncognitoNTP; self.hideShareButtonWhileOnIncognitoNTP = isNTP;
} }
#pragma mark - private #pragma mark - private
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment