OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.h" | 5 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.h" |
6 | 6 |
7 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" | 7 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" |
8 #import "ios/clean/chrome/browser/ui/omnibox/location_bar_coordinator.h" | 8 #import "ios/clean/chrome/browser/ui/omnibox/location_bar_coordinator.h" |
9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_mediator.h" | 9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_mediator.h" |
10 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" | 10 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 return self; | 42 return self; |
43 } | 43 } |
44 | 44 |
45 - (void)setWebState:(web::WebState*)webState { | 45 - (void)setWebState:(web::WebState*)webState { |
46 _webState = webState; | 46 _webState = webState; |
47 self.mediator.webState = self.webState; | 47 self.mediator.webState = self.webState; |
48 } | 48 } |
49 | 49 |
50 - (void)start { | 50 - (void)start { |
51 self.viewController = [[ToolbarViewController alloc] init]; | 51 self.viewController = [[ToolbarViewController alloc] |
| 52 initWithDispatcher:static_cast<id>(self.browser->dispatcher())]; |
52 | 53 |
53 CommandDispatcher* dispatcher = self.browser->dispatcher(); | 54 CommandDispatcher* dispatcher = self.browser->dispatcher(); |
54 [dispatcher startDispatchingToTarget:self | 55 [dispatcher startDispatchingToTarget:self |
55 forSelector:@selector(showToolsMenu)]; | 56 forSelector:@selector(showToolsMenu)]; |
56 [dispatcher startDispatchingToTarget:self | 57 [dispatcher startDispatchingToTarget:self |
57 forSelector:@selector(closeToolsMenu)]; | 58 forSelector:@selector(closeToolsMenu)]; |
58 [dispatcher startDispatchingToTarget:self forSelector:@selector(goBack)]; | 59 [dispatcher startDispatchingToTarget:self forSelector:@selector(goBack)]; |
59 [dispatcher startDispatchingToTarget:self forSelector:@selector(goForward)]; | 60 [dispatcher startDispatchingToTarget:self forSelector:@selector(goForward)]; |
60 [dispatcher startDispatchingToTarget:self forSelector:@selector(reloadPage)]; | 61 [dispatcher startDispatchingToTarget:self forSelector:@selector(reloadPage)]; |
61 [dispatcher startDispatchingToTarget:self | 62 [dispatcher startDispatchingToTarget:self |
62 forSelector:@selector(stopLoadingPage)]; | 63 forSelector:@selector(stopLoadingPage)]; |
63 | 64 |
64 self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher()); | |
65 self.mediator.consumer = self.viewController; | 65 self.mediator.consumer = self.viewController; |
66 self.mediator.webStateList = &self.browser->web_state_list(); | 66 self.mediator.webStateList = &self.browser->web_state_list(); |
67 | 67 |
68 [self.browser->broadcaster() | 68 [self.browser->broadcaster() |
69 addObserver:self.mediator | 69 addObserver:self.mediator |
70 forSelector:@selector(broadcastTabStripVisible:)]; | 70 forSelector:@selector(broadcastTabStripVisible:)]; |
71 LocationBarCoordinator* locationBarCoordinator = | 71 LocationBarCoordinator* locationBarCoordinator = |
72 [[LocationBarCoordinator alloc] init]; | 72 [[LocationBarCoordinator alloc] init]; |
73 self.locationBarCoordinator = locationBarCoordinator; | 73 self.locationBarCoordinator = locationBarCoordinator; |
74 [self addChildCoordinator:locationBarCoordinator]; | 74 [self addChildCoordinator:locationBarCoordinator]; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 - (void)stopLoadingPage { | 141 - (void)stopLoadingPage { |
142 self.webState->Stop(); | 142 self.webState->Stop(); |
143 } | 143 } |
144 | 144 |
145 - (void)reloadPage { | 145 - (void)reloadPage { |
146 self.webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL, | 146 self.webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL, |
147 false /*check_for_repost*/); | 147 false /*check_for_repost*/); |
148 } | 148 } |
149 | 149 |
150 @end | 150 @end |
OLD | NEW |