Commit 822d9d9d authored by Pete Schaffner's avatar Pete Schaffner Committed by Commit Bot

[iOS] Replace New Tab and New Incognito Tab quick actions with

search-focused "New Search" and "Incognito Search" actions.

This replaces the force-touch shortcuts to open new tabs with the
omnibox focused.

This also updates the current quick action icon set to be more
harmonious and in sync with the Material icon set.

Bug: 957837
Change-Id: I6f40f98a675b2a92031d40f3f38efbe3d19ff4d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1712873Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarNik Bhagat <nikunjb@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697651}
parent 5932c840
...@@ -43,8 +43,8 @@ using base::UserMetricsAction; ...@@ -43,8 +43,8 @@ using base::UserMetricsAction;
namespace { namespace {
// Constants for 3D touch application static shortcuts. // Constants for 3D touch application static shortcuts.
NSString* const kShortcutNewTab = @"OpenNewTab"; NSString* const kShortcutNewSearch = @"OpenNewSearch";
NSString* const kShortcutNewIncognitoTab = @"OpenIncognitoTab"; NSString* const kShortcutNewIncognitoSearch = @"OpenIncognitoSearch";
NSString* const kShortcutVoiceSearch = @"OpenVoiceSearch"; NSString* const kShortcutVoiceSearch = @"OpenVoiceSearch";
NSString* const kShortcutQRScanner = @"OpenQRScanner"; NSString* const kShortcutQRScanner = @"OpenQRScanner";
...@@ -337,30 +337,33 @@ NSString* const kShortcutQRScanner = @"OpenQRScanner"; ...@@ -337,30 +337,33 @@ NSString* const kShortcutQRScanner = @"OpenQRScanner";
initWithExternalURL:GURL(kChromeUINewTabURL) initWithExternalURL:GURL(kChromeUINewTabURL)
completeURL:GURL(kChromeUINewTabURL)]; completeURL:GURL(kChromeUINewTabURL)];
if ([shortcutItem.type isEqualToString:kShortcutNewTab]) { if ([shortcutItem.type isEqualToString:kShortcutNewSearch]) {
base::RecordAction(UserMetricsAction("ApplicationShortcut.NewTabPressed")); base::RecordAction(
[startupInformation setStartupParameters:startupParams]; UserMetricsAction("ApplicationShortcut.NewSearchPressed"));
startupParams.postOpeningAction = FOCUS_OMNIBOX;
startupInformation.startupParameters = startupParams;
return YES; return YES;
} else if ([shortcutItem.type isEqualToString:kShortcutNewIncognitoTab]) { } else if ([shortcutItem.type isEqualToString:kShortcutNewIncognitoSearch]) {
base::RecordAction( base::RecordAction(
UserMetricsAction("ApplicationShortcut.NewIncognitoTabPressed")); UserMetricsAction("ApplicationShortcut.NewIncognitoSearchPressed"));
[startupParams setLaunchInIncognito:YES]; startupParams.launchInIncognito = YES;
[startupInformation setStartupParameters:startupParams]; startupParams.postOpeningAction = FOCUS_OMNIBOX;
startupInformation.startupParameters = startupParams;
return YES; return YES;
} else if ([shortcutItem.type isEqualToString:kShortcutVoiceSearch]) { } else if ([shortcutItem.type isEqualToString:kShortcutVoiceSearch]) {
base::RecordAction( base::RecordAction(
UserMetricsAction("ApplicationShortcut.VoiceSearchPressed")); UserMetricsAction("ApplicationShortcut.VoiceSearchPressed"));
[startupParams setPostOpeningAction:START_VOICE_SEARCH]; startupParams.postOpeningAction = START_VOICE_SEARCH;
[startupInformation setStartupParameters:startupParams]; startupInformation.startupParameters = startupParams;
return YES; return YES;
} else if ([shortcutItem.type isEqualToString:kShortcutQRScanner]) { } else if ([shortcutItem.type isEqualToString:kShortcutQRScanner]) {
base::RecordAction( base::RecordAction(
UserMetricsAction("ApplicationShortcut.ScanQRCodePressed")); UserMetricsAction("ApplicationShortcut.ScanQRCodePressed"));
[startupParams setPostOpeningAction:START_QR_CODE_SCANNER]; startupParams.postOpeningAction = START_QR_CODE_SCANNER;
[startupInformation setStartupParameters:startupParams]; startupInformation.startupParameters = startupParams;
return YES; return YES;
} }
......
...@@ -587,8 +587,8 @@ TEST_F(UserActivityHandlerTest, PerformActionForShortcutItemWithRealShortcut) { ...@@ -587,8 +587,8 @@ TEST_F(UserActivityHandlerTest, PerformActionForShortcutItemWithRealShortcut) {
[fakeStartupInformation setIsPresentingFirstRunUI:NO]; [fakeStartupInformation setIsPresentingFirstRunUI:NO];
NSArray* parametersToTest = @[ NSArray* parametersToTest = @[
@[ @"OpenNewTab", @NO, @(NO_ACTION) ], @[ @"OpenNewSearch", @NO, @(FOCUS_OMNIBOX) ],
@[ @"OpenIncognitoTab", @YES, @(NO_ACTION) ], @[ @"OpenIncognitoSearch", @YES, @(FOCUS_OMNIBOX) ],
@[ @"OpenVoiceSearch", @NO, @(START_VOICE_SEARCH) ], @[ @"OpenVoiceSearch", @NO, @(START_VOICE_SEARCH) ],
@[ @"OpenQRScanner", @NO, @(START_QR_CODE_SCANNER) ] @[ @"OpenQRScanner", @NO, @(START_QR_CODE_SCANNER) ]
]; ];
...@@ -636,7 +636,7 @@ TEST_F(UserActivityHandlerTest, PerformActionForShortcutItemWithFirstRunUI) { ...@@ -636,7 +636,7 @@ TEST_F(UserActivityHandlerTest, PerformActionForShortcutItemWithFirstRunUI) {
[[[startupInformationMock stub] andReturnValue:@YES] isPresentingFirstRunUI]; [[[startupInformationMock stub] andReturnValue:@YES] isPresentingFirstRunUI];
UIApplicationShortcutItem* shortcut = UIApplicationShortcutItem* shortcut =
[[UIApplicationShortcutItem alloc] initWithType:@"OpenNewTab" [[UIApplicationShortcutItem alloc] initWithType:@"OpenNewSearch"
localizedTitle:@""]; localizedTitle:@""];
swizzleHandleStartupParameters(); swizzleHandleStartupParameters();
......
...@@ -151,19 +151,19 @@ generate_localizable_strings("system_strings") { ...@@ -151,19 +151,19 @@ generate_localizable_strings("system_strings") {
] ]
} }
imageset("quick_action_new_incognito_tab") { imageset("quick_action_incognito_search") {
sources = [ sources = [
"quick_action_new_incognito_tab.imageset/Contents.json", "quick_action_incognito_search.imageset/Contents.json",
"quick_action_new_incognito_tab.imageset/quick_action_new_incognito_tab@2x.png", "quick_action_incognito_search.imageset/quick_action_incognito_search@2x.png",
"quick_action_new_incognito_tab.imageset/quick_action_new_incognito_tab@3x.png", "quick_action_incognito_search.imageset/quick_action_incognito_search@3x.png",
] ]
} }
imageset("quick_action_new_tab") { imageset("quick_action_new_search") {
sources = [ sources = [
"quick_action_new_tab.imageset/Contents.json", "quick_action_new_search.imageset/Contents.json",
"quick_action_new_tab.imageset/quick_action_new_tab@2x.png", "quick_action_new_search.imageset/quick_action_new_search@2x.png",
"quick_action_new_tab.imageset/quick_action_new_tab@3x.png", "quick_action_new_search.imageset/quick_action_new_search@3x.png",
] ]
} }
...@@ -185,8 +185,8 @@ imageset("quick_action_voice_search") { ...@@ -185,8 +185,8 @@ imageset("quick_action_voice_search") {
group("quick_action_icons") { group("quick_action_icons") {
public_deps = [ public_deps = [
":quick_action_new_incognito_tab", ":quick_action_incognito_search",
":quick_action_new_tab", ":quick_action_new_search",
":quick_action_qr_scanner", ":quick_action_qr_scanner",
":quick_action_voice_search", ":quick_action_voice_search",
] ]
......
...@@ -92,19 +92,19 @@ ...@@ -92,19 +92,19 @@
<array> <array>
<dict> <dict>
<key>UIApplicationShortcutItemIconFile</key> <key>UIApplicationShortcutItemIconFile</key>
<string>quick_action_new_tab</string> <string>quick_action_new_search</string>
<key>UIApplicationShortcutItemTitle</key> <key>UIApplicationShortcutItemTitle</key>
<string>IDS_IOS_APPLICATION_SHORTCUT_NEWTAB_TITLE</string> <string>IDS_IOS_APPLICATION_SHORTCUT_NEWSEARCH_TITLE</string>
<key>UIApplicationShortcutItemType</key> <key>UIApplicationShortcutItemType</key>
<string>OpenNewTab</string> <string>OpenNewSearch</string>
</dict> </dict>
<dict> <dict>
<key>UIApplicationShortcutItemIconFile</key> <key>UIApplicationShortcutItemIconFile</key>
<string>quick_action_new_incognito_tab</string> <string>quick_action_incognito_search</string>
<key>UIApplicationShortcutItemTitle</key> <key>UIApplicationShortcutItemTitle</key>
<string>IDS_IOS_APPLICATION_SHORTCUT_NEWINCOGNITOTAB_TITLE</string> <string>IDS_IOS_APPLICATION_SHORTCUT_INCOGNITOSEARCH_TITLE</string>
<key>UIApplicationShortcutItemType</key> <key>UIApplicationShortcutItemType</key>
<string>OpenIncognitoTab</string> <string>OpenIncognitoSearch</string>
</dict> </dict>
<dict> <dict>
<key>UIApplicationShortcutItemIconFile</key> <key>UIApplicationShortcutItemIconFile</key>
......
...@@ -95,8 +95,8 @@ ...@@ -95,8 +95,8 @@
<key>output</key> <key>output</key>
<string>NSFaceIDUsageDescription</string> <string>NSFaceIDUsageDescription</string>
</dict> </dict>
<string>IDS_IOS_APPLICATION_SHORTCUT_NEWTAB_TITLE</string> <string>IDS_IOS_APPLICATION_SHORTCUT_NEWSEARCH_TITLE</string>
<string>IDS_IOS_APPLICATION_SHORTCUT_NEWINCOGNITOTAB_TITLE</string> <string>IDS_IOS_APPLICATION_SHORTCUT_INCOGNITOSEARCH_TITLE</string>
<string>IDS_IOS_APPLICATION_SHORTCUT_VOICE_SEARCH_TITLE</string> <string>IDS_IOS_APPLICATION_SHORTCUT_VOICE_SEARCH_TITLE</string>
<string>IDS_IOS_APPLICATION_SHORTCUT_QR_SCANNER_TITLE</string> <string>IDS_IOS_APPLICATION_SHORTCUT_QR_SCANNER_TITLE</string>
</array> </array>
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
{ {
"idiom": "universal", "idiom": "universal",
"scale": "2x", "scale": "2x",
"filename": "quick_action_new_incognito_tab@2x.png" "filename": "quick_action_incognito_search@2x.png"
}, },
{ {
"idiom": "universal", "idiom": "universal",
"scale": "3x", "scale": "3x",
"filename": "quick_action_new_incognito_tab@3x.png" "filename": "quick_action_incognito_search@3x.png"
} }
], ],
"info": { "info": {
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
{ {
"idiom": "universal", "idiom": "universal",
"scale": "2x", "scale": "2x",
"filename": "quick_action_new_tab@2x.png" "filename": "quick_action_new_search@2x.png"
}, },
{ {
"idiom": "universal", "idiom": "universal",
"scale": "3x", "scale": "3x",
"filename": "quick_action_new_tab@3x.png" "filename": "quick_action_new_search@3x.png"
} }
], ],
"info": { "info": {
......
...@@ -147,13 +147,13 @@ BOOL SetStartupParametersForSpotlightAction( ...@@ -147,13 +147,13 @@ BOOL SetStartupParametersForSpotlightAction(
NSString* voiceSearchAction = NSString* voiceSearchAction =
base::SysUTF8ToNSString(spotlight::kSpotlightActionVoiceSearch); base::SysUTF8ToNSString(spotlight::kSpotlightActionVoiceSearch);
NSString* newTabTitle = NSString* newTabTitle = l10n_util::GetNSString(
l10n_util::GetNSString(IDS_IOS_APPLICATION_SHORTCUT_NEWTAB_TITLE); IDS_IOS_APPLICATION_SHORTCUT_NEWSEARCH_TITLE);
NSString* newTabAction = NSString* newTabAction =
base::SysUTF8ToNSString(spotlight::kSpotlightActionNewTab); base::SysUTF8ToNSString(spotlight::kSpotlightActionNewTab);
NSString* incognitoTitle = l10n_util::GetNSString( NSString* incognitoTitle = l10n_util::GetNSString(
IDS_IOS_APPLICATION_SHORTCUT_NEWINCOGNITOTAB_TITLE); IDS_IOS_APPLICATION_SHORTCUT_INCOGNITOSEARCH_TITLE);
NSString* incognitoAction = base::SysUTF8ToNSString( NSString* incognitoAction = base::SysUTF8ToNSString(
spotlight::kSpotlightActionNewIncognitoTab); spotlight::kSpotlightActionNewIncognitoTab);
......
...@@ -212,11 +212,11 @@ locale. The strings in this file are specific to iOS. ...@@ -212,11 +212,11 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_USE_SUGGESTED_PASSWORD" desc="Button title in a suggested password popup asking user if they want to use the suggested password. [Length: 20em] [iOS only]"> <message name="IDS_IOS_USE_SUGGESTED_PASSWORD" desc="Button title in a suggested password popup asking user if they want to use the suggested password. [Length: 20em] [iOS only]">
Use Suggested Password Use Suggested Password
</message> </message>
<message name="IDS_IOS_APPLICATION_SHORTCUT_NEWINCOGNITOTAB_TITLE" desc="Message when opening a New Incognito Tab from springboard force touch static shortcuts. [Length: unlimited] [iOS only]." meaning="3D Touch entry to create a new Incognito tab."> <message name="IDS_IOS_APPLICATION_SHORTCUT_INCOGNITOSEARCH_TITLE" desc="Message when opening a New Incognito Search from springboard force touch static shortcuts. [Length: unlimited] [iOS only]." meaning="3D Touch entry to create a new Incognito tab.">
New Incognito Tab Incognito Search
</message> </message>
<message name="IDS_IOS_APPLICATION_SHORTCUT_NEWTAB_TITLE" desc="Message when opening a New Tab from springboard force touch static shortcuts. [Length: unlimited] [iOS only]." meaning="3D Touch entry to create a new tab."> <message name="IDS_IOS_APPLICATION_SHORTCUT_NEWSEARCH_TITLE" desc="Message when opening a New Search from springboard force touch static shortcuts. [Length: unlimited] [iOS only]." meaning="3D Touch entry to create a new tab.">
New Tab New Search
</message> </message>
<message name="IDS_IOS_APPLICATION_SHORTCUT_QR_SCANNER_TITLE" desc="Message when opening a QR Scanner from springboard force touch static shortcuts. [Length: unlimited] [iOS only]."> <message name="IDS_IOS_APPLICATION_SHORTCUT_QR_SCANNER_TITLE" desc="Message when opening a QR Scanner from springboard force touch static shortcuts. [Length: unlimited] [iOS only].">
Scan QR Code Scan QR Code
......
...@@ -2319,6 +2319,22 @@ should be able to be added at any place in this file. ...@@ -2319,6 +2319,22 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description> <description>Please enter the description of this user action.</description>
</action> </action>
<action name="ApplicationShortcut.NewIncognitoSearchPressed">
<owner>pschaffner@chromium.com</owner>
<description>
Force pressed on a springboard shortcut and tapped Incognito Search in
Chrome for iOS.
</description>
</action>
<action name="ApplicationShortcut.NewSearchPressed">
<owner>pschaffner@chromium.com</owner>
<description>
Force pressed on a springboard shortcut and tapped New Search in Chrome for
iOS.
</description>
</action>
<action name="AppList_AutoLaunchCanceled"> <action name="AppList_AutoLaunchCanceled">
<obsolete>Voice search in Launcher is not supported anymore.</obsolete> <obsolete>Voice search in Launcher is not supported anymore.</obsolete>
<owner>Please list the metric's owners. Add more owner tags as needed.</owner> <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
......
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