Commit 78f3d5ab authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Remove -chromeExecuteCommand:

Since ClearBrowsingDataCommand is no longer used (removed by
http://crrev.com/c/934501), there is no need to support the
deprecated -chromeExecuteCommand:.

Remove it and all the legacy support (GenericChromeCommand,
old #import, ...).

Bug: 738881
Change-Id: I004e548733550824aca4e9f5d0609e7172d2da1a
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/934270
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539475}
parent 10fde2da
......@@ -253,12 +253,6 @@
startupInformation:_startupInformation];
}
#pragma mark - chromeExecuteCommand
- (void)chromeExecuteCommand:(id)sender {
[_mainController chromeExecuteCommand:sender];
}
#pragma mark - Testing methods
- (MainController*)mainController {
......
......@@ -46,11 +46,6 @@
// to the user preferences.
@property(nonatomic, weak) MetricsMediator* metricsMediator;
// UIResponder addition to execute a Chrome command. Overridden in UIWindow to
// forward the call to the application delegate. The application delegate
// forwards the call to this class.
- (void)chromeExecuteCommand:(id)sender;
// Returns whether the tab switcher is active.
- (BOOL)isTabSwitcherActive;
......
......@@ -109,9 +109,6 @@
#import "ios/chrome/browser/tabs/tab_model_observer.h"
#import "ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller.h"
#import "ios/chrome/browser/ui/browser_view_controller.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#import "ios/chrome/browser/ui/commands/clear_browsing_data_command.h"
#include "ios/chrome/browser/ui/commands/ios_command_ids.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/show_signin_command.h"
......@@ -1625,33 +1622,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
completion:nil];
}
#pragma mark - chromeExecuteCommand
- (IBAction)chromeExecuteCommand:(id)sender {
NSInteger command = [sender tag];
switch (command) {
case IDC_CLEAR_BROWSING_DATA_IOS: {
// Clear both the main browser state and the associated incognito
// browser state.
ClearBrowsingDataCommand* command =
base::mac::ObjCCastStrict<ClearBrowsingDataCommand>(sender);
DCHECK(![command browserState]->IsOffTheRecord());
[self removeBrowsingDataForBrowserState:[command browserState]
timePeriod:[command timePeriod]
removeMask:[command mask]
completionBlock:[command completionBlock]];
break;
}
default:
// Unknown commands get dropped with a warning.
NOTREACHED() << "Unknown command id " << command;
LOG(WARNING) << "Unknown command id " << command;
break;
}
}
#pragma mark - chromeExecuteCommand helpers
#pragma mark - ApplicationCommands helpers
- (void)openUrlFromSettings:(OpenUrlCommand*)command {
DCHECK([command fromChrome]);
......
......@@ -69,8 +69,6 @@
#import "ios/chrome/browser/tabs/tab_private.h"
#include "ios/chrome/browser/translate/chrome_ios_translate_client.h"
#import "ios/chrome/browser/u2f/u2f_controller.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#include "ios/chrome/browser/ui/commands/ios_command_ids.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/show_signin_command.h"
......
......@@ -30,7 +30,6 @@
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#include "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
#import "ios/chrome/browser/ui/authentication/authentication_ui_util.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#import "ios/chrome/browser/ui/commands/browsing_data_commands.h"
#import "ios/chrome/browser/ui/settings/import_data_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
......
......@@ -5,21 +5,14 @@
source_set("commands") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"UIKit+ChromeExecuteCommand.h",
"UIKit+ChromeExecuteCommand.mm",
"activity_service_commands.h",
"application_commands.h",
"browser_commands.h",
"browsing_data_commands.h",
"clear_browsing_data_command.h",
"clear_browsing_data_command.mm",
"command_dispatcher.h",
"command_dispatcher.mm",
"external_search_commands.h",
"generic_chrome_command.h",
"generic_chrome_command.mm",
"history_popup_commands.h",
"ios_command_ids.h",
"open_new_tab_command.h",
"open_new_tab_command.mm",
"open_url_command.h",
......
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_COMMANDS_UIKIT_CHROMEEXECUTECOMMAND_H_
#define IOS_CHROME_BROWSER_UI_COMMANDS_UIKIT_CHROMEEXECUTECOMMAND_H_
#import <UIKit/UIKit.h>
@interface UIResponder (ChromeExecuteCommand)
// Executes a Chrome command. |sender| must implement the |-tag| method and
// return the id of the command to execute. The default implementation of this
// method simply forwards the call to the next responder.
- (IBAction)chromeExecuteCommand:(id)sender;
@end
@interface UIWindow (ChromeExecuteCommand)
// UIResponder addition to execute a Chrome command. Overridden in UIWindow to
// forward the call to the application's delegate.
- (void)chromeExecuteCommand:(id)sender;
@end
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_UIKIT_CHROMEEXECUTECOMMAND_H_
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation UIResponder (ChromeExecuteCommand)
- (void)chromeExecuteCommand:(id)sender {
[[self nextResponder] chromeExecuteCommand:sender];
}
@end
@implementation UIWindow (ChromeExecuteCommand)
- (void)chromeExecuteCommand:(id)sender {
id delegate = [[UIApplication sharedApplication] delegate];
if ([delegate respondsToSelector:@selector(chromeExecuteCommand:)])
[delegate chromeExecuteCommand:sender];
}
@end
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_COMMANDS_CLEAR_BROWSING_DATA_COMMAND_H_
#define IOS_CHROME_BROWSER_UI_COMMANDS_CLEAR_BROWSING_DATA_COMMAND_H_
#import <Foundation/Foundation.h>
#import "base/ios/block_types.h"
#import "components/browsing_data/core/browsing_data_utils.h"
#include "ios/chrome/browser/browsing_data/browsing_data_remove_mask.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
namespace ios {
class ChromeBrowserState;
}
// Command sent to clear the browsing data associated with a browser state.
@interface ClearBrowsingDataCommand : GenericChromeCommand
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE;
// Initializes a command intented to clear browsing data for |browserState|
// that corresponds to removal mask |mask| for the time period |timePeriod|.
// |completionBlock| will be invoked when the data has been cleared.
- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
mask:(BrowsingDataRemoveMask)mask
timePeriod:(browsing_data::TimePeriod)timePeriod
completionBlock:(ProceduralBlock)completionBlock
NS_DESIGNATED_INITIALIZER;
// When executed this command will remove browsing data for this BrowserState.
@property(nonatomic, readonly) ios::ChromeBrowserState* browserState;
// Removal mask: see BrowsingDataRemover::RemoveDataMask.
@property(nonatomic, readonly) BrowsingDataRemoveMask mask;
// Time period for which the browsing data will be removed.
@property(nonatomic, readonly) browsing_data::TimePeriod timePeriod;
// Completion block invoked when the data has been cleared.
@property(nonatomic, readonly) ProceduralBlock completionBlock;
@end
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_CLEAR_BROWSING_DATA_COMMAND_H_
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/commands/clear_browsing_data_command.h"
#include "base/logging.h"
#include "ios/chrome/browser/ui/commands/ios_command_ids.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation ClearBrowsingDataCommand
@synthesize browserState = _browserState;
@synthesize mask = _mask;
@synthesize timePeriod = _timePeriod;
@synthesize completionBlock = _completionBlock;
- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
mask:(BrowsingDataRemoveMask)mask
timePeriod:(browsing_data::TimePeriod)timePeriod
completionBlock:(ProceduralBlock)completionBlock {
self = [super initWithTag:IDC_CLEAR_BROWSING_DATA_IOS];
if (self) {
DCHECK(browserState);
_browserState = browserState;
_mask = mask;
_timePeriod = timePeriod;
_completionBlock = completionBlock;
}
return self;
}
@end
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_COMMANDS_GENERIC_CHROME_COMMAND_H_
#define IOS_CHROME_BROWSER_UI_COMMANDS_GENERIC_CHROME_COMMAND_H_
#import <Foundation/Foundation.h>
// Generic command that can be passed to |chromeExecuteCommand|.
@interface GenericChromeCommand : NSObject
// Command tag.
@property(nonatomic, assign) NSInteger tag;
// Returns an autoreleased GenericChromeCommand with given |tag|.
+ (instancetype)commandWithTag:(NSInteger)tag;
// Initializes the GenericChromeCommand with given |tag|.
- (instancetype)initWithTag:(NSInteger)tag NS_DESIGNATED_INITIALIZER;
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)init NS_UNAVAILABLE;
// Convenience method to execute this command on the main window.
- (void)executeOnMainWindow;
@end
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_GENERIC_CHROME_COMMAND_H_
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#import <UIKit/UIKit.h>
#include "base/logging.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation GenericChromeCommand
@synthesize tag = _tag;
+ (instancetype)commandWithTag:(NSInteger)tag {
return [[self alloc] initWithTag:tag];
}
- (instancetype)initWithTag:(NSInteger)tag {
self = [super init];
if (self) {
_tag = tag;
}
return self;
}
- (void)executeOnMainWindow {
UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow];
DCHECK(mainWindow);
[mainWindow chromeExecuteCommand:self];
}
@end
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_COMMANDS_IOS_COMMAND_IDS_H_
#define IOS_CHROME_BROWSER_UI_COMMANDS_IOS_COMMAND_IDS_H_
// This file lists all the command IDs understood by e.g. the browser.
// It is used by NIB files.
// NIB files include ID numbers rather than the corresponding #define labels.
// If you change a given command's number, any NIB files that refer to it will
// also need to be updated.
// clang-format off
#define IDC_CLEAR_BROWSING_DATA_IOS 40924
// clang-format on
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_IOS_COMMAND_IDS_H_
......@@ -7,18 +7,16 @@
#import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
// Command sent to open a new tab, optionally including a point (in UIWindow
// coordinates).
@interface OpenNewTabCommand : GenericChromeCommand
@interface OpenNewTabCommand : NSObject
- (instancetype)initWithIncognito:(BOOL)incognito
originPoint:(CGPoint)originPoint
NS_DESIGNATED_INITIALIZER;
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
// Convenience initializers
......
......@@ -17,7 +17,7 @@
- (instancetype)initWithIncognito:(BOOL)incognito
originPoint:(CGPoint)originPoint {
if ((self = [super initWithTag:0])) {
if ((self = [super init])) {
_incognito = incognito;
_originPoint = originPoint;
_userInitiated = YES;
......
......@@ -7,7 +7,6 @@
#import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#import "ios/chrome/browser/ui/url_loader.h"
namespace web {
......@@ -17,10 +16,10 @@ struct Referrer;
class GURL;
// A command to open a new tab.
@interface OpenUrlCommand : GenericChromeCommand
@interface OpenUrlCommand : NSObject
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
// Initializes a command intended to open a URL as a link from a page.
- (instancetype)initWithURL:(const GURL&)url
......
......@@ -22,17 +22,12 @@
@synthesize fromChrome = _fromChrome;
@synthesize appendTo = _appendTo;
- (instancetype)initWithTag:(NSInteger)tag {
NOTREACHED();
return nil;
}
- (instancetype)initWithURL:(const GURL&)url
referrer:(const web::Referrer&)referrer
inIncognito:(BOOL)inIncognito
inBackground:(BOOL)inBackground
appendTo:(OpenPosition)appendTo {
if ((self = [super initWithTag:0])) {
if ((self = [super init])) {
_url = url;
_referrer = referrer;
_inIncognito = inIncognito;
......
......@@ -7,16 +7,14 @@
#import <Foundation/Foundation.h>
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
class GURL;
@interface ReadingListAddCommand : GenericChromeCommand
@interface ReadingListAddCommand : NSObject
@property(nonatomic, readonly) const GURL& URL;
@property(copy, nonatomic, readonly) NSString* title;
- (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithURL:(const GURL&)URL
title:(NSString*)title NS_DESIGNATED_INITIALIZER;
......
......@@ -19,16 +19,11 @@
@synthesize URL = _URL;
- (instancetype)initWithURL:(const GURL&)URL title:(NSString*)title {
if (self = [super initWithTag:0]) {
if (self = [super init]) {
_URL = URL;
_title = title;
}
return self;
}
- (instancetype)initWithTag:(NSInteger)tag {
NOTREACHED();
return nil;
}
@end
......@@ -8,7 +8,6 @@
#import <Foundation/Foundation.h>
#include "components/signin/core/browser/signin_metrics.h"
#include "ios/chrome/browser/ui/commands/generic_chrome_command.h"
@class ChromeIdentity;
......@@ -29,10 +28,10 @@ enum AuthenticationOperation {
};
// A command to perform a sign in operation.
@interface ShowSigninCommand : GenericChromeCommand
@interface ShowSigninCommand : NSObject
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
// Initializes a command to perform the specified operation with a
// SigninInteractionController and invoke a possibly-nil callback when finished.
......
......@@ -18,18 +18,13 @@
@synthesize promoAction = _promoAction;
@synthesize callback = _callback;
- (instancetype)initWithTag:(NSInteger)tag {
NOTREACHED();
return nil;
}
- (instancetype)initWithOperation:(AuthenticationOperation)operation
identity:(ChromeIdentity*)identity
accessPoint:(signin_metrics::AccessPoint)accessPoint
promoAction:(signin_metrics::PromoAction)promoAction
callback:
(ShowSigninCommandCompletionCallback)callback {
if ((self = [super initWithTag:0])) {
if ((self = [super init])) {
DCHECK(operation == AUTHENTICATION_OPERATION_SIGNIN || identity == nil);
_operation = operation;
_identity = identity;
......
......@@ -7,18 +7,16 @@
#import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
// Command sent to start a voice search, optionally including the view from
// which the voice search present and dismiss animations will occur.
@interface StartVoiceSearchCommand : GenericChromeCommand
@interface StartVoiceSearchCommand : NSObject
- (instancetype)initWithOriginView:(UIView*)view NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTag:(NSInteger)tag NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
@property(nonatomic, readonly) UIView* originView;
@end
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_START_VOICE_SEARCH_COMMAND_H_
\ No newline at end of file
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_START_VOICE_SEARCH_COMMAND_H_
......@@ -13,10 +13,10 @@
@synthesize originView = _originView;
- (instancetype)initWithOriginView:(UIView*)originView {
if ((self = [super initWithTag:0])) {
if ((self = [super init])) {
_originView = originView;
}
return self;
}
@end
\ No newline at end of file
@end
......@@ -43,7 +43,6 @@
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/browsing_data_commands.h"
#import "ios/chrome/browser/ui/commands/open_url_command.h"
......
......@@ -14,7 +14,6 @@
#include "ios/chrome/browser/sync/sync_setup_service.h"
#include "ui/gfx/image/image.h"
@class GenericChromeCommand;
@protocol SyncPresenter;
namespace gfx {
......
......@@ -10,7 +10,6 @@
#include "google_apis/gaia/google_service_auth_error.h"
#include "ios/chrome/browser/sync/sync_setup_service.h"
@class GenericChromeCommand;
@class Tab;
@protocol SyncPresenter;
......
......@@ -12,8 +12,6 @@
#include "ios/chrome/browser/sync/sync_setup_service.h"
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#import "ios/chrome/browser/tabs/tab.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#include "ios/chrome/browser/ui/commands/ios_command_ids.h"
#import "ios/chrome/browser/ui/commands/show_signin_command.h"
#include "ios/chrome/browser/ui/settings/sync_utils/sync_error_infobar_delegate.h"
#include "ios/chrome/grit/ios_chromium_strings.h"
......
......@@ -15,7 +15,6 @@
#include "ios/chrome/browser/drag_and_drop/drop_and_navigate_interaction.h"
#include "ios/chrome/browser/experimental_flags.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#import "ios/chrome/browser/ui/image_util/image_util.h"
#include "ios/chrome/browser/ui/rtl_geometry.h"
#include "ios/chrome/browser/ui/ui_util.h"
......
......@@ -15,7 +15,6 @@ class ChromeBrowserState;
@protocol ApplicationCommands;
@class DeviceSharingManager;
@class GenericChromeCommand;
@class MainController;
@class NewTabPageController;
@class UIViewController;
......
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