Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm |
| index 024760945c4c7d6c0238c8d770ee008cb35b87cc..9da5ce0b7f550328d42cda5af1e6c5833346dc1a 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_controller.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm |
| @@ -18,6 +18,7 @@ |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/google/google_util.h" |
| #include "chrome/browser/instant/instant_controller.h" |
| +#include "chrome/browser/mac/closure_blocks_leopard_compat.h" |
|
Mark Mentovai
2011/08/15 14:43:57
Remove this from this file. You haven’t used any ^
Nico
2011/08/15 16:39:46
AOn 2011/08/15 14:43:57, Mark Mentovai wrote:
|
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_info_cache.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| @@ -43,7 +44,6 @@ |
| #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
| #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| -#import "chrome/browser/ui/cocoa/gesture_utils.h" |
| #import "chrome/browser/ui/cocoa/image_utils.h" |
| #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| @@ -157,33 +157,6 @@ |
| @end |
| -// Forward-declare symbols that are part of the 10.6 SDK. |
| -#if !defined(MAC_OS_X_VERSION_10_6) || \ |
| - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
| - |
| -enum { |
| - NSTouchPhaseBegan = 1U << 0, |
| - NSTouchPhaseMoved = 1U << 1, |
| - NSTouchPhaseStationary = 1U << 2, |
| - NSTouchPhaseEnded = 1U << 3, |
| - NSTouchPhaseCancelled = 1U << 4, |
| - NSTouchPhaseTouching = NSTouchPhaseBegan | NSTouchPhaseMoved | |
| - NSTouchPhaseStationary, |
| - NSTouchPhaseAny = NSUIntegerMax |
| -}; |
| -typedef NSUInteger NSTouchPhase; |
| - |
| -@interface NSEvent (SnowLeopardDeclarations) |
| -- (NSSet*)touchesMatchingPhase:(NSTouchPhase)phase inView:(NSView*)view; |
| -@end |
| - |
| -@interface NSTouch : NSObject |
| -- (NSPoint)normalizedPosition; |
| -- (id<NSObject, NSCopying>)identity; |
| -@end |
| - |
| -#endif // MAC_OS_X_VERSION_10_6 |
| - |
| // Provide the forward-declarations of new 10.7 SDK symbols so they can be |
| // called when building with the 10.5 SDK. |
| #if !defined(MAC_OS_X_VERSION_10_7) || \ |
| @@ -1784,96 +1757,6 @@ enum { |
| } |
| } |
| -// Documented in 10.6+, but present starting in 10.5. Called at the beginning |
| -// of a gesture. |
| -- (void)beginGestureWithEvent:(NSEvent*)event { |
| - totalMagnifyGestureAmount_ = 0; |
| - currentZoomStepDelta_ = 0; |
| - |
| - // On Lion, there's support controlled by a System Preference for two- and |
| - // three-finger navigational gestures. If set to allow three-finger gestures, |
| - // the system gesture recognizer will automatically call |-swipeWithEvent:| |
| - // and that will be handled as it would be on Snow Leopard. The two-finger |
| - // gesture does not do this, so it must be manually recognized. See the note |
| - // inside RecognizeTwoFingerGestures() for detailed information on the |
| - // interaction of the different preferences. |
| - if (!gesture_utils::RecognizeTwoFingerGestures()) |
| - return; |
| - NSSet* touches = [event touchesMatchingPhase:NSTouchPhaseAny |
| - inView:nil]; |
| - if ([touches count] >= 2) { |
| - twoFingerGestureTouches_.reset([[NSMutableDictionary alloc] init]); |
| - for (NSTouch* touch in touches) { |
| - [twoFingerGestureTouches_ setObject:touch forKey:touch.identity]; |
| - } |
| - } |
| -} |
| - |
| -- (void)endGestureWithEvent:(NSEvent*)event { |
| - // This method only needs to process gesture events for two-finger navigation. |
| - if (!twoFingerGestureTouches_.get()) |
| - return; |
| - |
| - // When a multi-touch gesture ends, only one touch will be in the "End" phase. |
| - // Other touches will be in "Moved" or "Unknown" phases. So long as one is |
| - // ended, which it is by virtue of this method being called, the gesture can |
| - // be committed so long as the magnitude is great enough. |
| - NSSet* touches = [event touchesMatchingPhase:NSTouchPhaseAny |
| - inView:nil]; |
| - |
| - // Store the touch data locally and reset the ivar so that new gestures can |
| - // begin. |
| - scoped_nsobject<NSDictionary> beginTouches( |
| - twoFingerGestureTouches_.release()); |
| - |
| - // Construct a vector of magnitudes. Since gesture events do not have the |
| - // |-deltaX| property set, this creates the X/Y magnitudes for each finger. |
| - std::vector<CGFloat> deltasX; |
| - std::vector<CGFloat> deltasY; |
| - for (NSTouch* touch in touches) { |
| - NSTouch* beginTouch = [beginTouches objectForKey:touch.identity]; |
| - if (!beginTouch) |
| - continue; |
| - |
| - // The |normalizedPosition| is scaled from (0, 1). |
| - NSPoint beginPoint = beginTouch.normalizedPosition; |
| - NSPoint endPoint = touch.normalizedPosition; |
| - |
| - deltasX.push_back(endPoint.x - beginPoint.x); |
| - deltasY.push_back(endPoint.y - beginPoint.y); |
| - } |
| - |
| - // Need at least two points to gesture. |
| - if (deltasX.size() < 2) |
| - return; |
| - |
| - CGFloat sumX = std::accumulate(deltasX.begin(), deltasX.end(), 0.0f); |
| - CGFloat sumY = std::accumulate(deltasY.begin(), deltasY.end(), 0.0f); |
| - |
| - // If the Y magnitude is greater than the X, then don't treat this as a |
| - // gesture. It was likely a vertical scroll instead. |
| - if (std::abs(sumY) > std::abs(sumX)) |
| - return; |
| - |
| - // On Lion, the user can choose to use a "natural" scroll direction with |
| - // inverted axes. |
| - if (gesture_utils::IsScrollDirectionInverted()) |
| - sumX *= -1; |
| - |
| - int command_id = 0; |
| - if (sumX > 0.3) |
| - command_id = IDC_FORWARD; |
| - else if (sumX < -0.3) |
| - command_id = IDC_BACK; |
| - else |
| - return; |
| - |
| - if (browser_->command_updater()->IsCommandEnabled(command_id)) { |
| - browser_->ExecuteCommandWithDisposition(command_id, |
| - event_utils::WindowOpenDispositionFromNSEvent(event)); |
| - } |
| -} |
| - |
| // Delegate method called when window is resized. |
| - (void)windowDidResize:(NSNotification*)notification { |
| // Resize (and possibly move) the status bubble. Note that we may get called |