Commit 5e55f551 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Remove StartVoiceSearchCommand.

The origin view location is now communicated via NamedGuides.

This is patch 1 of a 3-way patch.

Bug: 805123
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I44c595341907b27f81a58b02895746c6cf284250
Reviewed-on: https://chromium-review.googlesource.com/981777
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547766}
parent 148c09b8
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/commands/open_url_command.h" #import "ios/chrome/browser/ui/commands/open_url_command.h"
#import "ios/chrome/browser/ui/commands/show_signin_command.h" #import "ios/chrome/browser/ui/commands/show_signin_command.h"
#import "ios/chrome/browser/ui/commands/start_voice_search_command.h"
#import "ios/chrome/browser/ui/download/legacy_download_manager_controller.h" #import "ios/chrome/browser/ui/download/legacy_download_manager_controller.h"
#import "ios/chrome/browser/ui/external_file_remover_factory.h" #import "ios/chrome/browser/ui/external_file_remover_factory.h"
#import "ios/chrome/browser/ui/external_file_remover_impl.h" #import "ios/chrome/browser/ui/external_file_remover_impl.h"
...@@ -420,7 +419,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -420,7 +419,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
// Shows the tab switcher UI. // Shows the tab switcher UI.
- (void)showTabSwitcher; - (void)showTabSwitcher;
// Starts a voice search on the current BVC. // Starts a voice search on the current BVC.
- (void)startVoiceSearchInCurrentBVCWithOriginView:(UIView*)originView; - (void)startVoiceSearchInCurrentBVC;
// Dismisses the tab switcher UI without animation into the given model. // Dismisses the tab switcher UI without animation into the given model.
- (void)dismissTabSwitcherWithoutAnimationInModel:(TabModel*)tabModel; - (void)dismissTabSwitcherWithoutAnimationInModel:(TabModel*)tabModel;
// Dismisses |signinInteractionCoordinator|. // Dismisses |signinInteractionCoordinator|.
...@@ -1414,9 +1413,9 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1414,9 +1413,9 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[self.currentBVC.dispatcher openNewTab:command]; [self.currentBVC.dispatcher openNewTab:command];
} }
- (void)startVoiceSearch:(StartVoiceSearchCommand*)command { - (void)startVoiceSearch {
if (!_isProcessingTabSwitcherCommand) { if (!_isProcessingTabSwitcherCommand) {
[self startVoiceSearchInCurrentBVCWithOriginView:command.originView]; [self startVoiceSearchInCurrentBVC];
_isProcessingVoiceSearchCommand = YES; _isProcessingVoiceSearchCommand = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
kExpectedTransitionDurationInNanoSeconds), kExpectedTransitionDurationInNanoSeconds),
...@@ -1426,6 +1425,10 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1426,6 +1425,10 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
} }
} }
- (void)startVoiceSearch:(StartVoiceSearchCommand*)command {
[self startVoiceSearch];
}
- (void)showHistory { - (void)showHistory {
if (experimental_flags::IsCollectionsUIRebootEnabled()) { if (experimental_flags::IsCollectionsUIRebootEnabled()) {
// New History UIReboot coordinator. // New History UIReboot coordinator.
...@@ -1674,15 +1677,15 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1674,15 +1677,15 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[self closeSettingsAnimated:YES completion:completion]; [self closeSettingsAnimated:YES completion:completion];
} }
- (void)startVoiceSearchInCurrentBVCWithOriginView:(UIView*)originView { - (void)startVoiceSearchInCurrentBVC {
// If the background (non-current) BVC is playing TTS audio, call // If the background (non-current) BVC is playing TTS audio, call
// -startVoiceSearch on it to stop the TTS. // -startVoiceSearch on it to stop the TTS.
BrowserViewController* backgroundBVC = BrowserViewController* backgroundBVC =
self.mainBVC == self.currentBVC ? self.otrBVC : self.mainBVC; self.mainBVC == self.currentBVC ? self.otrBVC : self.mainBVC;
if (backgroundBVC.playingTTS) if (backgroundBVC.playingTTS)
[backgroundBVC startVoiceSearchWithOriginView:originView]; [backgroundBVC startVoiceSearch];
else else
[self.currentBVC startVoiceSearchWithOriginView:originView]; [self.currentBVC startVoiceSearch];
} }
#pragma mark - Preferences Management #pragma mark - Preferences Management
...@@ -2185,7 +2188,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -2185,7 +2188,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
case START_VOICE_SEARCH: case START_VOICE_SEARCH:
if (@available(iOS 11, *)) { if (@available(iOS 11, *)) {
return ^{ return ^{
[self startVoiceSearchInCurrentBVCWithOriginView:nil]; [self startVoiceSearchInCurrentBVC];
}; };
} else { } else {
return ^{ return ^{
...@@ -2201,8 +2204,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -2201,8 +2204,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
// TODO(crbug.com/766951): remove this workaround. // TODO(crbug.com/766951): remove this workaround.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 100 * NSEC_PER_MSEC), dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 100 * NSEC_PER_MSEC),
dispatch_get_main_queue(), ^{ dispatch_get_main_queue(), ^{
[self [self startVoiceSearchInCurrentBVC];
startVoiceSearchInCurrentBVCWithOriginView:nil];
}); });
}; };
......
...@@ -137,9 +137,8 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -137,9 +137,8 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
// related to showing the previously selected tab. // related to showing the previously selected tab.
- (void)expectNewForegroundTab; - (void)expectNewForegroundTab;
// Shows the voice search UI. |originView|'s center is used for the presentation // Shows the voice search UI.
// and dismissal animations of the Voice Search UI. |originView| can be nil. - (void)startVoiceSearch;
- (void)startVoiceSearchWithOriginView:(UIView*)originView;
// Dismisses all presented views, excluding the omnibox if |dismissOmnibox| is // Dismisses all presented views, excluding the omnibox if |dismissOmnibox| is
// NO, then calls |completion|. // NO, then calls |completion|.
......
...@@ -136,7 +136,6 @@ ...@@ -136,7 +136,6 @@
#import "ios/chrome/browser/ui/commands/reading_list_add_command.h" #import "ios/chrome/browser/ui/commands/reading_list_add_command.h"
#import "ios/chrome/browser/ui/commands/show_signin_command.h" #import "ios/chrome/browser/ui/commands/show_signin_command.h"
#import "ios/chrome/browser/ui/commands/snackbar_commands.h" #import "ios/chrome/browser/ui/commands/snackbar_commands.h"
#import "ios/chrome/browser/ui/commands/start_voice_search_command.h"
#import "ios/chrome/browser/ui/commands/toolbar_commands.h" #import "ios/chrome/browser/ui/commands/toolbar_commands.h"
#import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h"
#import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h" #import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h"
...@@ -558,9 +557,6 @@ NSString* const kBrowserViewControllerSnackbarCategory = ...@@ -558,9 +557,6 @@ NSString* const kBrowserViewControllerSnackbarCategory =
// Notifies the toolbar menu of reading list changes. // Notifies the toolbar menu of reading list changes.
ReadingListMenuNotifier* _readingListMenuNotifier; ReadingListMenuNotifier* _readingListMenuNotifier;
// The view used by the voice search presentation animation.
__weak UIView* _voiceSearchButton;
// Coordinator for the share menu (Activity Services). // Coordinator for the share menu (Activity Services).
ActivityServiceLegacyCoordinator* _activityServiceCoordinator; ActivityServiceLegacyCoordinator* _activityServiceCoordinator;
...@@ -1453,8 +1449,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint { ...@@ -1453,8 +1449,7 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
_expectingForegroundTab = YES; _expectingForegroundTab = YES;
} }
- (void)startVoiceSearchWithOriginView:(UIView*)originView { - (void)startVoiceSearch {
_voiceSearchButton = originView;
// Delay Voice Search until new tab animations have finished. // Delay Voice Search until new tab animations have finished.
if (self.inNewTabAnimation) { if (self.inNewTabAnimation) {
_startVoiceSearchAfterNewTabAnimation = YES; _startVoiceSearchAfterNewTabAnimation = YES;
...@@ -4974,7 +4969,7 @@ bubblePresenterForFeature:(const base::Feature&)feature ...@@ -4974,7 +4969,7 @@ bubblePresenterForFeature:(const base::Feature&)feature
ProceduralBlock startVoiceSearchIfNecessaryBlock = ^void() { ProceduralBlock startVoiceSearchIfNecessaryBlock = ^void() {
if (_startVoiceSearchAfterNewTabAnimation) { if (_startVoiceSearchAfterNewTabAnimation) {
_startVoiceSearchAfterNewTabAnimation = NO; _startVoiceSearchAfterNewTabAnimation = NO;
[self startVoiceSearchWithOriginView:nil]; [self startVoiceSearch];
} }
}; };
...@@ -5426,10 +5421,6 @@ bubblePresenterForFeature:(const base::Feature&)feature ...@@ -5426,10 +5421,6 @@ bubblePresenterForFeature:(const base::Feature&)feature
#pragma mark - VoiceSearchPresenter (Public) #pragma mark - VoiceSearchPresenter (Public)
- (UIView*)voiceSearchButton {
return _voiceSearchButton;
}
- (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
return [self currentLogoAnimationControllerOwner]; return [self currentLogoAnimationControllerOwner];
} }
......
...@@ -64,6 +64,9 @@ ...@@ -64,6 +64,9 @@
- (void)switchModesAndOpenNewTab:(OpenNewTabCommand*)newTabCommand; - (void)switchModesAndOpenNewTab:(OpenNewTabCommand*)newTabCommand;
// Starts a voice search on the current BVC. // Starts a voice search on the current BVC.
- (void)startVoiceSearch;
// Deprecated |-startVoiceSearchCommand|.
// TODO(crbug.com/805123): Remove this command.
- (void)startVoiceSearch:(StartVoiceSearchCommand*)command; - (void)startVoiceSearch:(StartVoiceSearchCommand*)command;
// Shows the History UI. // Shows the History UI.
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#import "ios/chrome/browser/ui/UIView+SizeClassSupport.h" #import "ios/chrome/browser/ui/UIView+SizeClassSupport.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h"
#include "ios/chrome/browser/ui/commands/start_voice_search_command.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_synchronizing.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_synchronizing.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_utils.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_utils.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h"
...@@ -366,9 +365,7 @@ const UIEdgeInsets kSearchBoxStretchInsets = {3, 3, 3, 3}; ...@@ -366,9 +365,7 @@ const UIEdgeInsets kSearchBoxStretchInsets = {3, 3, 3, 3};
UIView* voiceSearchButton = base::mac::ObjCCastStrict<UIView>(sender); UIView* voiceSearchButton = base::mac::ObjCCastStrict<UIView>(sender);
[NamedGuide guideWithName:kVoiceSearchButtonGuide view:voiceSearchButton] [NamedGuide guideWithName:kVoiceSearchButtonGuide view:voiceSearchButton]
.constrainedView = voiceSearchButton; .constrainedView = voiceSearchButton;
StartVoiceSearchCommand* command = [self.dispatcher startVoiceSearch];
[[StartVoiceSearchCommand alloc] initWithOriginView:voiceSearchButton];
[self.dispatcher startVoiceSearch:command];
} }
- (void)preloadVoiceSearch:(id)sender { - (void)preloadVoiceSearch:(id)sender {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#include "ios/chrome/browser/ui/commands/start_voice_search_command.h"
#import "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h" #import "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h"
#include "ios/chrome/browser/ui/rtl_geometry.h" #include "ios/chrome/browser/ui/rtl_geometry.h"
#import "ios/chrome/browser/ui/util/named_guide.h" #import "ios/chrome/browser/ui/util/named_guide.h"
...@@ -203,10 +202,7 @@ keyCommandsForConsumer:(id<KeyCommandsPlumbing>)consumer ...@@ -203,10 +202,7 @@ keyCommandsForConsumer:(id<KeyCommandsPlumbing>)consumer
[[NamedGuide guideWithName:kVoiceSearchButtonGuide [[NamedGuide guideWithName:kVoiceSearchButtonGuide
view:baseView] view:baseView]
resetConstraints]; resetConstraints];
StartVoiceSearchCommand* command = [weakDispatcher startVoiceSearch];
[[StartVoiceSearchCommand alloc]
initWithOriginView:nil];
[weakDispatcher startVoiceSearch:command];
}], }],
]]; ]];
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h"
#import "ios/chrome/browser/ui/commands/history_popup_commands.h" #import "ios/chrome/browser/ui/commands/history_popup_commands.h"
#import "ios/chrome/browser/ui/commands/start_voice_search_command.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_animator.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_animator.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_foreground_animator.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_foreground_animator.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_scroll_end_animator.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_scroll_end_animator.h"
...@@ -658,9 +657,7 @@ const CGFloat kScrollFadeDistance = 30; ...@@ -658,9 +657,7 @@ const CGFloat kScrollFadeDistance = 30;
UIView* view = base::mac::ObjCCastStrict<UIView>(sender); UIView* view = base::mac::ObjCCastStrict<UIView>(sender);
[NamedGuide guideWithName:kVoiceSearchButtonGuide view:view].constrainedView = [NamedGuide guideWithName:kVoiceSearchButtonGuide view:view].constrainedView =
view; view;
StartVoiceSearchCommand* command = [self.dispatcher startVoiceSearch];
[[StartVoiceSearchCommand alloc] initWithOriginView:view];
[self.dispatcher startVoiceSearch:command];
} }
// Sets all Toolbar Buttons opacity to |alpha|. // Sets all Toolbar Buttons opacity to |alpha|.
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h"
#import "ios/chrome/browser/ui/commands/external_search_commands.h" #import "ios/chrome/browser/ui/commands/external_search_commands.h"
#import "ios/chrome/browser/ui/commands/start_voice_search_command.h"
#import "ios/chrome/browser/ui/location_bar/location_bar_constants.h" #import "ios/chrome/browser/ui/location_bar/location_bar_constants.h"
#import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h"
#import "ios/chrome/browser/ui/util/named_guide.h" #import "ios/chrome/browser/ui/util/named_guide.h"
...@@ -56,9 +55,7 @@ ...@@ -56,9 +55,7 @@
CGRectGetHeight(frame); CGRectGetHeight(frame);
self.voiceSearchButtonGuide.constrainedFrame = frame; self.voiceSearchButtonGuide.constrainedFrame = frame;
} }
StartVoiceSearchCommand* command = [self.dispatcher startVoiceSearch];
[[StartVoiceSearchCommand alloc] initWithOriginView:view];
[self.dispatcher startVoiceSearch:command];
} }
} }
......
...@@ -10,11 +10,7 @@ ...@@ -10,11 +10,7 @@
#import "ios/public/provider/chrome/browser/voice/logo_animation_controller.h" #import "ios/public/provider/chrome/browser/voice/logo_animation_controller.h"
// Protocol used by UIViewControllers that present VoiceSearch. // Protocol used by UIViewControllers that present VoiceSearch.
@protocol VoiceSearchPresenter<LogoAnimationControllerOwnerOwner, NSObject> @protocol VoiceSearchPresenter<LogoAnimationControllerOwnerOwner>
// The button that was tapped in order to trigger VoiceSearch.
@property(nonatomic, readonly) UIView* voiceSearchButton;
@end @end
#endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_VOICE_VOICE_SEARCH_PRESENTER_H_ #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_VOICE_VOICE_SEARCH_PRESENTER_H_
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