OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 withImageEnum:NTPToolbarButtonNameForward | 118 withImageEnum:NTPToolbarButtonNameForward |
119 forInitialState:UIControlStateDisabled | 119 forInitialState:UIControlStateDisabled |
120 hasDisabledImage:YES | 120 hasDisabledImage:YES |
121 synchronously:NO]; | 121 synchronously:NO]; |
122 | 122 |
123 UILongPressGestureRecognizer* backLongPress = | 123 UILongPressGestureRecognizer* backLongPress = |
124 [[UILongPressGestureRecognizer alloc] | 124 [[UILongPressGestureRecognizer alloc] |
125 initWithTarget:self | 125 initWithTarget:self |
126 action:@selector(handleLongPress:)]; | 126 action:@selector(handleLongPress:)]; |
127 [_backButton addGestureRecognizer:backLongPress]; | 127 [_backButton addGestureRecognizer:backLongPress]; |
| 128 [_backButton addTarget:self.dispatcher |
| 129 action:@selector(goBack) |
| 130 forControlEvents:UIControlEventTouchUpInside]; |
| 131 |
128 UILongPressGestureRecognizer* forwardLongPress = | 132 UILongPressGestureRecognizer* forwardLongPress = |
129 [[UILongPressGestureRecognizer alloc] | 133 [[UILongPressGestureRecognizer alloc] |
130 initWithTarget:self | 134 initWithTarget:self |
131 action:@selector(handleLongPress:)]; | 135 action:@selector(handleLongPress:)]; |
132 [_forwardButton addGestureRecognizer:forwardLongPress]; | 136 [_forwardButton addGestureRecognizer:forwardLongPress]; |
133 [_backButton setTag:IDC_BACK]; | 137 [_forwardButton addTarget:self.dispatcher |
134 [_forwardButton setTag:IDC_FORWARD]; | 138 action:@selector(goForward) |
| 139 forControlEvents:UIControlEventTouchUpInside]; |
135 | 140 |
136 [_omniboxFocuser addTarget:self | 141 [_omniboxFocuser addTarget:self |
137 action:@selector(focusOmnibox:) | 142 action:@selector(focusOmnibox:) |
138 forControlEvents:UIControlEventTouchUpInside]; | 143 forControlEvents:UIControlEventTouchUpInside]; |
139 | 144 |
140 SetA11yLabelAndUiAutomationName(_backButton, IDS_ACCNAME_BACK, @"Back"); | 145 SetA11yLabelAndUiAutomationName(_backButton, IDS_ACCNAME_BACK, @"Back"); |
141 SetA11yLabelAndUiAutomationName(_forwardButton, IDS_ACCNAME_FORWARD, | 146 SetA11yLabelAndUiAutomationName(_forwardButton, IDS_ACCNAME_FORWARD, |
142 @"Forward"); | 147 @"Forward"); |
143 } | 148 } |
144 return self; | 149 return self; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 231 |
227 - (void)focusOmnibox:(id)sender { | 232 - (void)focusOmnibox:(id)sender { |
228 [self.dispatcher focusFakebox]; | 233 [self.dispatcher focusFakebox]; |
229 } | 234 } |
230 | 235 |
231 - (IBAction)stackButtonTouchDown:(id)sender { | 236 - (IBAction)stackButtonTouchDown:(id)sender { |
232 [self.dispatcher prepareToEnterTabSwitcher:self]; | 237 [self.dispatcher prepareToEnterTabSwitcher:self]; |
233 } | 238 } |
234 | 239 |
235 @end | 240 @end |
OLD | NEW |