Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: ios/chrome/browser/ui/stack_view/stack_view_controller.mm

Issue 2969103002: [ios] Remove IDC_SHOW_TOOLS_MENU
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/commands/ios_command_ids.h ('k') | ios/chrome/browser/ui/tab_switcher/tab_switcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/stack_view/stack_view_controller.mm
diff --git a/ios/chrome/browser/ui/stack_view/stack_view_controller.mm b/ios/chrome/browser/ui/stack_view/stack_view_controller.mm
index 91ed3a17d58a22108a274be1bb36dd5878add2fd..336cf04edd31a2995edf57eaa87782f38e9ed43e 100644
--- a/ios/chrome/browser/ui/stack_view/stack_view_controller.mm
+++ b/ios/chrome/browser/ui/stack_view/stack_view_controller.mm
@@ -29,6 +29,7 @@
#import "ios/chrome/browser/ui/animation_util.h"
#import "ios/chrome/browser/ui/background_generator.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
+#import "ios/chrome/browser/ui/commands/browser_commands.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/keyboard/UIKeyCommand+Chrome.h"
@@ -51,6 +52,7 @@
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#import "ios/chrome/common/material_timing.h"
#include "ios/chrome/grit/ios_strings.h"
+#import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h"
#import "ios/shared/chrome/browser/ui/tools_menu/tools_menu_configuration.h"
#include "ios/web/public/referrer.h"
#import "net/base/mac/url_conversions.h"
@@ -490,6 +492,8 @@ NSString* const kDummyToolbarBackgroundViewAnimationKey =
// |YES| if there is card set animation being processed. For testing only.
// Save last touch point used by new tab animation.
CGPoint _lastTapPoint;
+ // The dispacther instance used when this view controller is active.
+ CommandDispatcher* _dispatcher;
}
@synthesize activeCardSet = _activeCardSet;
@@ -530,6 +534,9 @@ NSString* const kDummyToolbarBackgroundViewAnimationKey =
initWithTarget:self
action:@selector(handleTapFrom:)];
[_modeSwitchRecognizer setDelegate:self];
+ _dispatcher = [[CommandDispatcher alloc] init];
+ [_dispatcher startDispatchingToTarget:self
+ forProtocol:@protocol(BrowserCommands)];
}
return self;
}
@@ -560,6 +567,10 @@ NSString* const kDummyToolbarBackgroundViewAnimationKey =
return nil;
}
+- (id<BrowserCommands>)browserCommandsDispatcher {
+ return static_cast<id<BrowserCommands>>(_dispatcher);
+}
+
- (void)setUpWithMainCardSet:(CardSet*)mainCardSet
otrCardSet:(CardSet*)otrCardSet
activeCardSet:(CardSet*)activeCardSet {
@@ -2683,13 +2694,26 @@ NSString* const kDummyToolbarBackgroundViewAnimationKey =
return nil;
}
+#pragma mark - BrowserCommands
+
+- (void)showToolsMenu {
+ ToolsMenuConfiguration* configuration =
+ [[ToolsMenuConfiguration alloc] initWithDisplayView:[self view]];
+ [configuration setInTabSwitcher:YES];
+ // When checking for the existence of tabs, catch the case where the main set
+ // is both active and empty, but the incognito set has some cards.
+ if (([[_activeCardSet cards] count] == 0) &&
+ (_activeCardSet == _otrCardSet || [[_otrCardSet cards] count] == 0))
+ [configuration setNoOpenedTabs:YES];
+ if (_activeCardSet == _otrCardSet)
+ [configuration setInIncognito:YES];
+ [_toolbarController showToolsMenuPopupWithConfiguration:configuration];
+}
+
- (IBAction)chromeExecuteCommand:(id)sender {
int command = [sender tag];
switch (command) {
- case IDC_SHOW_TOOLS_MENU:
- [self showToolsMenuPopup];
- break;
// Closing all while the main set is active closes everything, but closing
// all while incognito is active only closes incognito tabs.
case IDC_CLOSE_ALL_TABS:
@@ -2720,20 +2744,6 @@ NSString* const kDummyToolbarBackgroundViewAnimationKey =
}
}
-- (void)showToolsMenuPopup {
- ToolsMenuConfiguration* configuration =
- [[ToolsMenuConfiguration alloc] initWithDisplayView:[self view]];
- [configuration setInTabSwitcher:YES];
- // When checking for the existence of tabs, catch the case where the main set
- // is both active and empty, but the incognito set has some cards.
- if (([[_activeCardSet cards] count] == 0) &&
- (_activeCardSet == _otrCardSet || [[_otrCardSet cards] count] == 0))
- [configuration setNoOpenedTabs:YES];
- if (_activeCardSet == _otrCardSet)
- [configuration setInIncognito:YES];
- [_toolbarController showToolsMenuPopupWithConfiguration:configuration];
-}
-
#pragma mark Notification Handlers
- (void)allModelTabsHaveClosed:(NSNotification*)notify {
« no previous file with comments | « ios/chrome/browser/ui/commands/ios_command_ids.h ('k') | ios/chrome/browser/ui/tab_switcher/tab_switcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698