OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" | 5 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/debugger/devtools_window.h" | 10 #include "chrome/browser/debugger/devtools_window.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 usingHandler:^(CGFloat gestureAmount, | 248 usingHandler:^(CGFloat gestureAmount, |
249 NSEventPhase phase, | 249 NSEventPhase phase, |
250 BOOL isComplete, | 250 BOOL isComplete, |
251 BOOL *stop) { | 251 BOOL *stop) { |
252 if (phase == NSEventPhaseBegan) { | 252 if (phase == NSEventPhaseBegan) { |
253 [historyOverlay showPanelForView: | 253 [historyOverlay showPanelForView: |
254 render_widget_host_->view()->GetNativeView()]; | 254 render_widget_host_->view()->GetNativeView()]; |
255 return; | 255 return; |
256 } | 256 } |
257 | 257 |
| 258 BOOL ended = phase == NSEventPhaseEnded; |
| 259 |
| 260 // Dismiss the panel before navigation for immediate visual feedback. |
| 261 [historyOverlay setProgress:gestureAmount]; |
| 262 if (ended) |
| 263 [historyOverlay dismiss]; |
| 264 |
258 // |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice] | 265 // |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice] |
259 // automatically. | 266 // automatically. |
260 Browser* browser = BrowserList::FindBrowserWithWindow( | 267 Browser* browser = BrowserList::FindBrowserWithWindow( |
261 historyOverlay.view.window); | 268 historyOverlay.view.window); |
262 if (phase == NSEventPhaseEnded && browser) { | 269 if (ended && browser) { |
263 if (goForward) | 270 if (goForward) |
264 browser->GoForward(CURRENT_TAB); | 271 browser->GoForward(CURRENT_TAB); |
265 else | 272 else |
266 browser->GoBack(CURRENT_TAB); | 273 browser->GoBack(CURRENT_TAB); |
267 } | 274 } |
268 | 275 |
269 [historyOverlay setProgress:gestureAmount]; | 276 if (isComplete) |
270 if (isComplete) { | |
271 [historyOverlay dismiss]; | |
272 [historyOverlay release]; | 277 [historyOverlay release]; |
273 } | |
274 }]; | 278 }]; |
275 return YES; | 279 return YES; |
276 } | 280 } |
277 } | 281 } |
278 return gotUnhandledWheelEvent_; | 282 return gotUnhandledWheelEvent_; |
279 } | 283 } |
280 | 284 |
281 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item | 285 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item |
282 isValidItem:(BOOL*)valid { | 286 isValidItem:(BOOL*)valid { |
283 SEL action = [item action]; | 287 SEL action = [item action]; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 357 } |
354 | 358 |
355 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { | 359 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { |
356 spellcheck_enabled_ = enabled; | 360 spellcheck_enabled_ = enabled; |
357 spellcheck_checked_ = checked; | 361 spellcheck_checked_ = checked; |
358 } | 362 } |
359 | 363 |
360 // END Spellchecking methods | 364 // END Spellchecking methods |
361 | 365 |
362 @end | 366 @end |
OLD | NEW |