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

Side by Side Diff: ios/showcase/tools_menu/sc_tools_coordinator.mm

Issue 2944703002: [ios clean] Adds ToolsMenu to Showcase. (Closed)
Patch Set: Remove BUILD.gn model target 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 unified diff | Download patch
« no previous file with comments | « ios/showcase/tools_menu/sc_tools_coordinator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ios/showcase/tools_menu/sc_tools_coordinator.h"
6
7 #include "base/macros.h"
8 #import "ios/clean/chrome/browser/ui/commands/find_in_page_visibility_commands.h "
9 #import "ios/clean/chrome/browser/ui/commands/navigation_commands.h"
10 #import "ios/clean/chrome/browser/ui/commands/settings_commands.h"
11 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h"
12 #import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h"
13 #import "ios/clean/chrome/browser/ui/tools/tools_menu_item.h"
14 #import "ios/clean/chrome/browser/ui/tools/tools_menu_model.h"
15 #import "ios/showcase/common/protocol_alerter.h"
16 #include "ui/base/l10n/l10n_util.h"
17
18 @interface SCToolsCoordinator ()
19 @property(nonatomic, strong) ProtocolAlerter* alerter;
20 @end
21
22 @implementation SCToolsCoordinator
23 @synthesize baseViewController = _baseViewController;
24 @synthesize alerter = _alerter;
25
26 #pragma mark - BrowserCoordinator
27
28 - (void)start {
29 self.alerter = [[ProtocolAlerter alloc] initWithProtocols:@[
30 @protocol(FindInPageVisibilityCommands), @protocol(NavigationCommands),
31 @protocol(ToolsMenuCommands), @protocol(SettingsCommands)
32 ]];
33 self.alerter.baseViewController = self.baseViewController;
34
35 MenuViewController* viewController = [[MenuViewController alloc] init];
36 viewController.modalPresentationStyle = UIModalPresentationCustom;
37 viewController.dispatcher =
38 static_cast<id<FindInPageVisibilityCommands, NavigationCommands,
39 ToolsMenuCommands, SettingsCommands>>(self.alerter);
40
41 NSMutableArray* menuItems = [NSMutableArray array];
42
43 // Load the full model into the VC.
44 for (size_t i = 0; i < arraysize(itemsModelList); ++i) {
45 const MenuModelItem& modelItem = itemsModelList[i];
46 ToolsMenuItem* menuItem = [[ToolsMenuItem alloc] init];
47 menuItem.title = l10n_util::GetNSStringWithFixup(modelItem.title_id);
48 menuItem.action = NSSelectorFromString(modelItem.selector);
49 [menuItems addObject:menuItem];
50 }
51 [viewController setToolsMenuItems:menuItems];
52
53 // The Overflow controls will only be displayed on CompactWidth SizeClasses.
54 [viewController setDisplayOverflowControls:YES];
55
56 // Since the close MenuButton is always located on the top right corner,
57 // set the navigation translucency to NO so it doesn't cover the button.
58 self.baseViewController.navigationBar.translucent = NO;
59
60 [self.baseViewController pushViewController:viewController animated:YES];
61 }
62
63 @end
OLDNEW
« no previous file with comments | « 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