Commit d0a5d1f4 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Update omnibox popup row trailing button

This CL updates the trailing button displayed in the omnibox popup rows.
- The asset for the Switch to Open Tab button is updated.
- The color is changed, including the system button effect on highlight.
- The previous assets used before UI Refresh are removed.

Bug: 908777
Change-Id: I5c0b0d906089fc630824115a4e0b35d6d905c8f4
Reviewed-on: https://chromium-review.googlesource.com/c/1352151Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613055}
parent b6a95ca7
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_HTTPS_POLICY_WARNING" file="controlled_setting_mandatory.png" /> <structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_HTTPS_POLICY_WARNING" file="controlled_setting_mandatory.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_HTTPS_VALID" file="omnibox_https_valid.png" /> <structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_HTTPS_VALID" file="omnibox_https_valid.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND" file="omnibox/append_ios.png" /> <structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND" file="omnibox/append_ios.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_HIGHLIGHTED" file="omnibox/append_highlighted_ios.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO" file="omnibox/append_incognito_ios.png" /> <structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO" file="omnibox/append_incognito_ios.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO_HIGHLIGHTED" file="omnibox/append_incognito_highlighted_ios.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_OFFLINE" file="omnibox_offline.png" /> <structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_OFFLINE" file="omnibox_offline.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_SEARCH" file="omnibox_search.png" /> <structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_SEARCH" file="omnibox_search.png" />
<structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_SEARCH_INCOGNITO" file="omnibox_search_incognito.png" /> <structure type="chrome_scaled_image" name="IDR_IOS_OMNIBOX_SEARCH_INCOGNITO" file="omnibox_search_incognito.png" />
......
...@@ -59,6 +59,7 @@ source_set("popup_internal") { ...@@ -59,6 +59,7 @@ source_set("popup_internal") {
"//ios/chrome/app/theme:theme", "//ios/chrome/app/theme:theme",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state",
"//ios/chrome/browser/ui/omnibox:omnibox_popup_shared", "//ios/chrome/browser/ui/omnibox:omnibox_popup_shared",
"//ios/chrome/browser/ui/toolbar/public",
"//ios/chrome/browser/ui/util", "//ios/chrome/browser/ui/util",
"//ios/chrome/browser/ui/util:util", "//ios/chrome/browser/ui/util:util",
"//net", "//net",
......
...@@ -4,8 +4,11 @@ ...@@ -4,8 +4,11 @@
#import "ios/chrome/browser/ui/omnibox/popup/omnibox_popup_row.h" #import "ios/chrome/browser/ui/omnibox/popup/omnibox_popup_row.h"
#include "base/feature_list.h"
#include "base/logging.h" #include "base/logging.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#import "ios/chrome/browser/ui/omnibox/truncating_attributed_label.h" #import "ios/chrome/browser/ui/omnibox/truncating_attributed_label.h"
#import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h"
#include "ios/chrome/browser/ui/util/rtl_geometry.h" #include "ios/chrome/browser/ui/util/rtl_geometry.h"
#include "ios/chrome/browser/ui/util/ui_util.h" #include "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
...@@ -76,7 +79,11 @@ NSString* const kOmniboxPopupRowSwitchTabAccessibilityIdentifier = ...@@ -76,7 +79,11 @@ NSString* const kOmniboxPopupRowSwitchTabAccessibilityIdentifier =
_detailAnswerLabel.lineBreakMode = NSLineBreakByTruncatingTail; _detailAnswerLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[self.contentView addSubview:_detailAnswerLabel]; [self.contentView addSubview:_detailAnswerLabel];
_trailingButton = [UIButton buttonWithType:UIButtonTypeCustom]; if (base::FeatureList::IsEnabled(omnibox::kOmniboxTabSwitchSuggestions)) {
_trailingButton = [UIButton buttonWithType:UIButtonTypeSystem];
} else {
_trailingButton = [UIButton buttonWithType:UIButtonTypeCustom];
}
[_trailingButton setContentMode:UIViewContentModeRight]; [_trailingButton setContentMode:UIViewContentModeRight];
[self updateTrailingButtonImages]; [self updateTrailingButtonImages];
// TODO(justincohen): Consider using the UITableViewCell's accessory view. // TODO(justincohen): Consider using the UITableViewCell's accessory view.
...@@ -186,28 +193,30 @@ NSString* const kOmniboxPopupRowSwitchTabAccessibilityIdentifier = ...@@ -186,28 +193,30 @@ NSString* const kOmniboxPopupRowSwitchTabAccessibilityIdentifier =
_trailingButton.accessibilityIdentifier = nil; _trailingButton.accessibilityIdentifier = nil;
if (self.tabMatch) { if (self.tabMatch) {
appendImage = [UIImage imageNamed:@"omnibox_popup_tab_match"]; appendImage = [UIImage imageNamed:@"omnibox_popup_tab_match"];
appendImage = appendImage.imageFlippedForRightToLeftLayoutDirection;
_trailingButton.accessibilityIdentifier = _trailingButton.accessibilityIdentifier =
kOmniboxPopupRowSwitchTabAccessibilityIdentifier; kOmniboxPopupRowSwitchTabAccessibilityIdentifier;
} else { } else {
int appendResourceID = _incognito int appendResourceID = 0;
? IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO if (base::FeatureList::IsEnabled(omnibox::kOmniboxTabSwitchSuggestions)) {
: IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND; appendResourceID = IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND;
} else {
appendResourceID = _incognito
? IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO
: IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND;
}
appendImage = NativeReversableImage(appendResourceID, YES); appendImage = NativeReversableImage(appendResourceID, YES);
} }
if (IsUIRefreshPhase1Enabled()) { appendImage =
appendImage = [appendImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[appendImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; if (base::FeatureList::IsEnabled(omnibox::kOmniboxTabSwitchSuggestions)) {
_trailingButton.tintColor = _incognito
? [UIColor whiteColor]
: UIColorFromRGB(kLocationBarTintBlue);
} else {
_trailingButton.tintColor = _incognito _trailingButton.tintColor = _incognito
? [UIColor colorWithWhite:1 alpha:0.5] ? [UIColor colorWithWhite:1 alpha:0.5]
: [UIColor colorWithWhite:0 alpha:0.3]; : [UIColor colorWithWhite:0 alpha:0.3];
} else {
int appendSelectedResourceID =
_incognito ? IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO_HIGHLIGHTED
: IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_HIGHLIGHTED;
UIImage* appendImageSelected =
NativeReversableImage(appendSelectedResourceID, YES);
[_trailingButton setImage:appendImageSelected
forState:UIControlStateHighlighted];
} }
[_trailingButton setImage:appendImage forState:UIControlStateNormal]; [_trailingButton setImage:appendImage forState:UIControlStateNormal];
......
...@@ -7,7 +7,6 @@ import("//build/config/ios/asset_catalog.gni") ...@@ -7,7 +7,6 @@ import("//build/config/ios/asset_catalog.gni")
imageset("omnibox_popup_tab_match") { imageset("omnibox_popup_tab_match") {
sources = [ sources = [
"omnibox_popup_tab_match.imageset/Contents.json", "omnibox_popup_tab_match.imageset/Contents.json",
"omnibox_popup_tab_match.imageset/omnibox_popup_tab_match.png",
"omnibox_popup_tab_match.imageset/omnibox_popup_tab_match@2x.png", "omnibox_popup_tab_match.imageset/omnibox_popup_tab_match@2x.png",
"omnibox_popup_tab_match.imageset/omnibox_popup_tab_match@3x.png", "omnibox_popup_tab_match.imageset/omnibox_popup_tab_match@3x.png",
] ]
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
"images": [ "images": [
{ {
"idiom": "universal", "idiom": "universal",
"scale": "1x", "scale": "1x"
"filename": "omnibox_popup_tab_match.png"
}, },
{ {
"idiom": "universal", "idiom": "universal",
......
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