Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1466 | 1466 |
| 1467 // Install the view. | 1467 // Install the view. |
| 1468 [[[[self window] contentView] superview] addSubview:incognitoBadge_]; | 1468 [[[[self window] contentView] superview] addSubview:incognitoBadge_]; |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 // Documented in 10.6+, but present starting in 10.5. Called when we get a | 1471 // Documented in 10.6+, but present starting in 10.5. Called when we get a |
| 1472 // three-finger swipe. | 1472 // three-finger swipe. |
| 1473 - (void)swipeWithEvent:(NSEvent*)event { | 1473 - (void)swipeWithEvent:(NSEvent*)event { |
| 1474 // Map forwards and backwards to history; left is positive, right is negative. | 1474 // Map forwards and backwards to history; left is positive, right is negative. |
| 1475 unsigned int command = 0; | 1475 unsigned int command = 0; |
| 1476 if ([event deltaX] > 0.5) | 1476 if ([event deltaX] > 0.5) { |
| 1477 command = IDC_BACK; | 1477 command = IDC_BACK; |
| 1478 else if ([event deltaX] < -0.5) | 1478 } else if ([event deltaX] < -0.5) { |
| 1479 command = IDC_FORWARD; | 1479 command = IDC_FORWARD; |
| 1480 else if ([event deltaY] > 0.5) | 1480 } else if ([event deltaY] > 0.5) { |
| 1481 ; // TODO(pinkerton): figure out page-up, http://crbug.com/16305 | 1481 // TODO(pinkerton): figure out page-up, http://crbug.com/16305 |
|
Mark Mentovai
2010/06/11 18:47:35
Wow.
| |
| 1482 else if ([event deltaY] < -0.5) | 1482 } else if ([event deltaY] < -0.5) { |
| 1483 ; // TODO(pinkerton): figure out page-down, http://crbug.com/16305 | 1483 // TODO(pinkerton): figure out page-down, http://crbug.com/16305 |
| 1484 } | |
| 1484 | 1485 |
| 1485 // Ensure the command is valid first (ExecuteCommand() won't do that) and | 1486 // Ensure the command is valid first (ExecuteCommand() won't do that) and |
| 1486 // then make it so. | 1487 // then make it so. |
| 1487 if (browser_->command_updater()->IsCommandEnabled(command)) | 1488 if (browser_->command_updater()->IsCommandEnabled(command)) |
| 1488 browser_->ExecuteCommandWithDisposition(command, | 1489 browser_->ExecuteCommandWithDisposition(command, |
| 1489 event_utils::WindowOpenDispositionFromNSEvent(event)); | 1490 event_utils::WindowOpenDispositionFromNSEvent(event)); |
| 1490 } | 1491 } |
| 1491 | 1492 |
| 1492 // Documented in 10.6+, but present starting in 10.5. Called repeatedly during | 1493 // Documented in 10.6+, but present starting in 10.5. Called repeatedly during |
| 1493 // a pinch gesture, with incremental change values. | 1494 // a pinch gesture, with incremental change values. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1860 | 1861 |
| 1861 - (BOOL)supportsBookmarkBar { | 1862 - (BOOL)supportsBookmarkBar { |
| 1862 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 1863 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 1863 } | 1864 } |
| 1864 | 1865 |
| 1865 - (BOOL)isNormalWindow { | 1866 - (BOOL)isNormalWindow { |
| 1866 return browser_->type() == Browser::TYPE_NORMAL; | 1867 return browser_->type() == Browser::TYPE_NORMAL; |
| 1867 } | 1868 } |
| 1868 | 1869 |
| 1869 @end // @implementation BrowserWindowController(WindowType) | 1870 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |