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

Unified Diff: ios/showcase/tools_menu/sc_tools_coordinator.mm

Issue 2944703002: [ios clean] Adds ToolsMenu to Showcase. (Closed)
Patch Set: Created 3 years, 6 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
Index: ios/showcase/tools_menu/sc_tools_coordinator.mm
diff --git a/ios/showcase/tools_menu/sc_tools_coordinator.mm b/ios/showcase/tools_menu/sc_tools_coordinator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..c53467e06e6118db107fa310d739c93487318099
--- /dev/null
+++ b/ios/showcase/tools_menu/sc_tools_coordinator.mm
@@ -0,0 +1,64 @@
+// Copyright 2017 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/showcase/tools_menu/sc_tools_coordinator.h"
+
+#include "base/macros.h"
+#import "ios/clean/chrome/browser/ui/commands/find_in_page_visibility_commands.h"
+#import "ios/clean/chrome/browser/ui/commands/navigation_commands.h"
+#import "ios/clean/chrome/browser/ui/commands/settings_commands.h"
+#import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h"
+#import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h"
+#import "ios/clean/chrome/browser/ui/tools/tools_menu_item.h"
+#import "ios/clean/chrome/browser/ui/tools/tools_menu_model.h"
+#import "ios/showcase/common/protocol_alerter.h"
+#include "ui/base/l10n/l10n_util.h"
+
+@interface SCToolsCoordinator ()
+@property(nonatomic, strong) ProtocolAlerter* alerter;
+@end
+
+@implementation SCToolsCoordinator
+@synthesize baseViewController = _baseViewController;
+@synthesize alerter = _alerter;
+
+#pragma mark - BrowserCoordinator
+
+- (void)start {
+ self.alerter = [[ProtocolAlerter alloc] initWithProtocols:@[
+ @protocol(FindInPageVisibilityCommands), @protocol(NavigationCommands),
+ @protocol(ToolsMenuCommands), @protocol(SettingsCommands)
+ ]];
+ self.alerter.baseViewController = self.baseViewController;
+
+ MenuViewController* viewController = [[MenuViewController alloc] init];
+ viewController.modalPresentationStyle = UIModalPresentationCustom;
+ viewController.dispatcher =
+ static_cast<id<FindInPageVisibilityCommands, NavigationCommands,
+ ToolsMenuCommands, SettingsCommands>>(self.alerter);
+
+ NSMutableArray* menuItems = [NSMutableArray array];
+
+ // Load the full model into the VC.
+ for (size_t i = 0; i < arraysize(itemsModelList); ++i) {
+ const MenuModelItem& modelItem = itemsModelList[i];
+ ToolsMenuItem* menuItem = [[ToolsMenuItem alloc] init];
+ menuItem.title = l10n_util::GetNSStringWithFixup(modelItem.title_id);
+ menuItem.action = NSSelectorFromString(modelItem.selector);
+ [menuItems addObject:menuItem];
+ }
+ [viewController setToolsMenuItems:menuItems];
+
+ // The Overflow controls will only be displayed on CompactWidth SizeClasses.
lpromero 2017/06/19 09:38:49 Can you add a screenshot for non compact?
sczs 2017/06/19 19:44:38 Done.
+ [viewController setDisplayOverflowControls:YES];
+
+ // Since the close MenuButton is always located on the top right corner, we
+ // need to set the navigation translucency to NO so it doesn't cover the
lpromero 2017/06/19 09:38:49 Remove "we need to". It avoids "we" and should spa
sczs 2017/06/19 19:44:38 Aaaghhh, my bad! Thanks for pointing it out.
+ // button.
+ self.baseViewController.navigationBar.translucent = NO;
+
+ [self.baseViewController pushViewController:viewController animated:YES];
+}
+
+@end
« ios/showcase/tools_menu/BUILD.gn ('K') | « ios/showcase/tools_menu/sc_tools_coordinator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698