Commit 1977207d authored by Andy Lu's avatar Andy Lu Committed by Commit Bot

Search in Chrome Shortcut now accepts input

Make search in chrome accept a string input that will be searched in any search engine of user's choice

Bug: 1106922

Change-Id: I4bb79e8f0d77b04d1cf79cda83cbe87fe00eabb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2297731
Commit-Queue: Andy Lu <andyhylu@google.com>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarGuillaume Jenkins <gujen@google.com>
Cr-Commit-Position: refs/heads/master@{#790037}
parent 075d22b4
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#import "ios/chrome/app/application_delegate/tab_opening.h" #import "ios/chrome/app/application_delegate/tab_opening.h"
#include "ios/chrome/app/application_mode.h" #include "ios/chrome/app/application_mode.h"
#import "ios/chrome/app/intents/OpenInChromeIntent.h" #import "ios/chrome/app/intents/OpenInChromeIntent.h"
#import "ios/chrome/app/intents/SearchInChromeIntent.h"
#import "ios/chrome/app/spotlight/actions_spotlight_manager.h" #import "ios/chrome/app/spotlight/actions_spotlight_manager.h"
#import "ios/chrome/app/spotlight/spotlight_util.h" #import "ios/chrome/app/spotlight/spotlight_util.h"
#include "ios/chrome/app/startup/chrome_app_startup_parameters.h" #include "ios/chrome/app/startup/chrome_app_startup_parameters.h"
...@@ -144,10 +145,23 @@ NSString* const kShortcutQRScanner = @"OpenQRScanner"; ...@@ -144,10 +145,23 @@ NSString* const kShortcutQRScanner = @"OpenQRScanner";
} else if ([userActivity.activityType } else if ([userActivity.activityType
isEqualToString:@"SearchInChromeIntent"]) { isEqualToString:@"SearchInChromeIntent"]) {
base::RecordAction(UserMetricsAction("IOSLaunchedBySearchInChromeIntent")); base::RecordAction(UserMetricsAction("IOSLaunchedBySearchInChromeIntent"));
AppStartupParameters* startupParams = [[AppStartupParameters alloc] AppStartupParameters* startupParams = [[AppStartupParameters alloc]
initWithExternalURL:GURL(kChromeUINewTabURL) initWithExternalURL:GURL(kChromeUINewTabURL)
completeURL:GURL(kChromeUINewTabURL)]; completeURL:GURL(kChromeUINewTabURL)];
[startupParams setPostOpeningAction:FOCUS_OMNIBOX];
SearchInChromeIntent* intent =
base::mac::ObjCCastStrict<SearchInChromeIntent>(
userActivity.interaction.intent);
NSString* searchPhrase = intent.searchPhrase;
if ([searchPhrase length]) {
startupParams.textQuery = searchPhrase;
} else {
startupParams.postOpeningAction = FOCUS_OMNIBOX;
}
[connectionInformation setStartupParameters:startupParams]; [connectionInformation setStartupParameters:startupParams];
webpageURL = webpageURL =
[NSURL URLWithString:base::SysUTF8ToNSString(kChromeUINewTabURL)]; [NSURL URLWithString:base::SysUTF8ToNSString(kChromeUINewTabURL)];
......
...@@ -107,28 +107,69 @@ ...@@ -107,28 +107,69 @@
<dict> <dict>
<key>INIntentCategory</key> <key>INIntentCategory</key>
<string>information</string> <string>information</string>
<key>INIntentConfigurable</key>
<true/>
<key>INIntentDescriptionID</key> <key>INIntentDescriptionID</key>
<string>k0Ho6W</string> <string>k0Ho6W</string>
<key>INIntentName</key> <key>INIntentIneligibleForSuggestions</key>
<string>SearchInChrome</string> <true/>
<key>INIntentParameterCombinations</key> <key>INIntentInput</key>
<string>searchPhrase</string>
<key>INIntentLastParameterTag</key>
<integer>1</integer>
<key>INIntentManagedParameterCombinations</key>
<dict> <dict>
<key></key> <key>searchPhrase</key>
<dict> <dict>
<key>INIntentParameterCombinationIsPrimary</key>
<true/>
<key>INIntentParameterCombinationSubtitle</key>
<string>Start a search in a new Chrome tab.</string>
<key>INIntentParameterCombinationSubtitleID</key>
<string>4nGj7v</string>
<key>INIntentParameterCombinationSupportsBackgroundExecution</key> <key>INIntentParameterCombinationSupportsBackgroundExecution</key>
<false/> <true/>
<key>INIntentParameterCombinationTitle</key> <key>INIntentParameterCombinationTitle</key>
<string>Search in Chrome</string> <string>Search ${searchPhrase} in Chrome</string>
<key>INIntentParameterCombinationTitleID</key> <key>INIntentParameterCombinationTitleID</key>
<string>ceiocv</string> <string>TqBLdA</string>
<key>INIntentParameterCombinationUpdatesLinked</key>
<true/>
</dict> </dict>
</dict> </dict>
<key>INIntentName</key>
<string>SearchInChrome</string>
<key>INIntentParameters</key>
<array>
<dict>
<key>INIntentParameterDisplayName</key>
<string>Search phrase</string>
<key>INIntentParameterDisplayNameID</key>
<string>bsFAEt</string>
<key>INIntentParameterDisplayPriority</key>
<integer>1</integer>
<key>INIntentParameterMetadata</key>
<dict>
<key>INIntentParameterMetadataCapitalization</key>
<string>Sentences</string>
</dict>
<key>INIntentParameterName</key>
<string>searchPhrase</string>
<key>INIntentParameterPromptDialogs</key>
<array>
<dict>
<key>INIntentParameterPromptDialogCustom</key>
<true/>
<key>INIntentParameterPromptDialogFormatString</key>
<string>What do you want to search?</string>
<key>INIntentParameterPromptDialogFormatStringID</key>
<string>rIYS61</string>
<key>INIntentParameterPromptDialogType</key>
<string>Primary</string>
</dict>
</array>
<key>INIntentParameterSupportsResolution</key>
<true/>
<key>INIntentParameterTag</key>
<integer>1</integer>
<key>INIntentParameterType</key>
<string>String</string>
</dict>
</array>
<key>INIntentResponse</key> <key>INIntentResponse</key>
<dict> <dict>
<key>INIntentResponseCodes</key> <key>INIntentResponseCodes</key>
......
...@@ -46,6 +46,12 @@ ...@@ -46,6 +46,12 @@
<key>output</key> <key>output</key>
<string>Z6KvRw</string> <string>Z6KvRw</string>
</dict> </dict>
<dict>
<key>input</key>
<string>IDS_IOS_INTENTS_SEARCH_IN_CHROME_PARAMETER_COMBINATION_TITLE</string>
<key>output</key>
<string>TqBLdA</string>
</dict>
<dict> <dict>
<key>input</key> <key>input</key>
<string>IDS_IOS_INTENTS_OPEN_IN_CHROME_PARAMETER_COMBINATION_TITLE</string> <string>IDS_IOS_INTENTS_OPEN_IN_CHROME_PARAMETER_COMBINATION_TITLE</string>
......
...@@ -918,7 +918,11 @@ Because your account is managed by <ph name="HOSTED_DOMAIN">$1<ex>google.com</ex ...@@ -918,7 +918,11 @@ Because your account is managed by <ph name="HOSTED_DOMAIN">$1<ex>google.com</ex
Search in Chrome Search in Chrome
</message> </message>
<message name="IDS_IOS_INTENTS_SEARCH_IN_CHROME_TITLE" desc="Siri Shortcut for search in chrome title [iOS only]."> <message name="IDS_IOS_INTENTS_SEARCH_IN_CHROME_TITLE" desc="Siri Shortcut for search in chrome title [iOS only].">
Search in Chrome Search in Chrome
</message>
<message name="IDS_IOS_INTENTS_SEARCH_IN_CHROME_PARAMETER_COMBINATION_TITLE" desc="Apple Shortcuts App's format for displaying the user search phrase input, shown by the Siri Shortcut app when the
user is adding or editing a Search in Chrome shortcut[iOS only].">
Search ${searchPhrase} in Chrome
</message> </message>
<message name="IDS_IOS_JAVA_SCRIPT_DIALOG_BLOCKING_BUTTON_TEXT" desc="The text used for the button added to JavaScript dialogs to prevent a page from spamming the user with endless alerts. [Length:27em]"> <message name="IDS_IOS_JAVA_SCRIPT_DIALOG_BLOCKING_BUTTON_TEXT" desc="The text used for the button added to JavaScript dialogs to prevent a page from spamming the user with endless alerts. [Length:27em]">
Suppress Dialogs Suppress Dialogs
......
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