| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_history
_swiper.h" | 5 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history
_swiper.h" |
| 6 | 6 |
| 7 #import "base/mac/sdk_forward_declarations.h" | 7 #import "base/mac/sdk_forward_declarations.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 return [NSEvent isSwipeTrackingFromScrollEventsEnabled]; | 370 return [NSEvent isSwipeTrackingFromScrollEventsEnabled]; |
| 371 return NO; | 371 return NO; |
| 372 } | 372 } |
| 373 | 373 |
| 374 - (void)navigateBrowserInDirection: | 374 - (void)navigateBrowserInDirection: |
| 375 (history_swiper::NavigationDirection)direction { | 375 (history_swiper::NavigationDirection)direction { |
| 376 Browser* browser = chrome::FindBrowserWithWindow( | 376 Browser* browser = chrome::FindBrowserWithWindow( |
| 377 historyOverlay_.view.window); | 377 historyOverlay_.view.window); |
| 378 if (browser) { | 378 if (browser) { |
| 379 if (direction == history_swiper::kForwards) | 379 if (direction == history_swiper::kForwards) |
| 380 chrome::GoForward(browser, CURRENT_TAB); | 380 chrome::GoForward(browser, WindowOpenDisposition::CURRENT_TAB); |
| 381 else | 381 else |
| 382 chrome::GoBack(browser, CURRENT_TAB); | 382 chrome::GoBack(browser, WindowOpenDisposition::CURRENT_TAB); |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 | 385 |
| 386 - (BOOL)browserCanNavigateInDirection: | 386 - (BOOL)browserCanNavigateInDirection: |
| 387 (history_swiper::NavigationDirection)direction | 387 (history_swiper::NavigationDirection)direction |
| 388 event:(NSEvent*)event { | 388 event:(NSEvent*)event { |
| 389 Browser* browser = chrome::FindBrowserWithWindow([event window]); | 389 Browser* browser = chrome::FindBrowserWithWindow([event window]); |
| 390 if (!browser) | 390 if (!browser) |
| 391 return NO; | 391 return NO; |
| 392 | 392 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 progress = MAX(0.0, progress); | 475 progress = MAX(0.0, progress); |
| 476 progress = MIN(1.0, progress); | 476 progress = MIN(1.0, progress); |
| 477 [historyOverlay setProgress:progress finished:finished]; | 477 [historyOverlay setProgress:progress finished:finished]; |
| 478 | 478 |
| 479 // |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice] | 479 // |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice] |
| 480 // automatically. | 480 // automatically. |
| 481 Browser* browser = | 481 Browser* browser = |
| 482 chrome::FindBrowserWithWindow(historyOverlay.view.window); | 482 chrome::FindBrowserWithWindow(historyOverlay.view.window); |
| 483 if (ended && browser) { | 483 if (ended && browser) { |
| 484 if (isRightScroll) | 484 if (isRightScroll) |
| 485 chrome::GoForward(browser, CURRENT_TAB); | 485 chrome::GoForward(browser, WindowOpenDisposition::CURRENT_TAB); |
| 486 else | 486 else |
| 487 chrome::GoBack(browser, CURRENT_TAB); | 487 chrome::GoBack(browser, WindowOpenDisposition::CURRENT_TAB); |
| 488 } | 488 } |
| 489 | 489 |
| 490 if (ended || isComplete) { | 490 if (ended || isComplete) { |
| 491 [historyOverlay dismiss]; | 491 [historyOverlay dismiss]; |
| 492 [historyOverlay release]; | 492 [historyOverlay release]; |
| 493 historyOverlay = nil; | 493 historyOverlay = nil; |
| 494 } | 494 } |
| 495 }]; | 495 }]; |
| 496 } | 496 } |
| 497 | 497 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 | 585 |
| 586 @end | 586 @end |
| 587 | 587 |
| 588 @implementation HistorySwiper (PrivateExposedForTesting) | 588 @implementation HistorySwiper (PrivateExposedForTesting) |
| 589 + (void)resetMagicMouseState { | 589 + (void)resetMagicMouseState { |
| 590 forceMagicMouse = NO; | 590 forceMagicMouse = NO; |
| 591 } | 591 } |
| 592 @end | 592 @end |
| OLD | NEW |