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 7f5f04e56bfef1dc5d93516058ab3024021eb7c4..3a8ebe2a3c5cee957ac0225cbb40bdeaacc8525c 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm |
@@ -156,35 +156,32 @@ |
@end |
-// 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) || \ |
- MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
+// 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 { |
- NSWindowAnimationBehaviorDefault = 0, |
- NSWindowAnimationBehaviorNone = 2, |
- NSWindowAnimationBehaviorDocumentWindow = 3, |
- NSWindowAnimationBehaviorUtilityWindow = 4, |
- NSWindowAnimationBehaviorAlertPanel = 5 |
+ NSTouchPhaseBegan = 1U << 0, |
+ NSTouchPhaseMoved = 1U << 1, |
+ NSTouchPhaseStationary = 1U << 2, |
+ NSTouchPhaseEnded = 1U << 3, |
+ NSTouchPhaseCancelled = 1U << 4, |
+ NSTouchPhaseTouching = NSTouchPhaseBegan | NSTouchPhaseMoved | |
+ NSTouchPhaseStationary, |
+ NSTouchPhaseAny = NSUIntegerMax |
}; |
-typedef NSInteger NSWindowAnimationBehavior; |
+typedef NSUInteger NSTouchPhase; |
-enum { |
- NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, |
- NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 |
-}; |
- |
-enum { |
- NSFullScreenWindowMask = 1 << 14 |
-}; |
+@interface NSEvent (SnowLeopardDeclarations) |
+- (NSSet*)touchesMatchingPhase:(NSTouchPhase)phase inView:(NSView*)view; |
+@end |
-@interface NSWindow (LionSDKDeclarations) |
-- (void)setRestorable:(BOOL)flag; |
-- (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior; |
+@interface NSTouch : NSObject |
+- (NSPoint)normalizedPosition; |
+- (id<NSObject, NSCopying>)identity; |
@end |
-#endif // MAC_OS_X_VERSION_10_7 |
+#endif // MAC_OS_X_VERSION_10_6 |
@implementation BrowserWindowController |
@@ -223,7 +220,7 @@ enum { |
browser_.reset(browser); |
ownsBrowser_ = ownIt; |
NSWindow* window = [self window]; |
- windowShim_.reset(new BrowserWindowCocoa(browser, self, window)); |
+ windowShim_.reset(new BrowserWindowCocoa(browser, self)); |
// Create the bar visibility lock set; 10 is arbitrary, but should hopefully |
// be big enough to hold all locks that'll ever be needed. |
@@ -614,6 +611,8 @@ enum { |
// Called when we have been minimized. |
- (void)windowDidMiniaturize:(NSNotification *)notification { |
+ [self saveWindowPositionIfNeeded]; |
+ |
// Let the selected RenderWidgetHostView know, so that it can tell plugins. |
if (TabContents* contents = browser_->GetSelectedTabContents()) { |
if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) |
@@ -1763,6 +1762,8 @@ enum { |
// Delegate method called when window is resized. |
- (void)windowDidResize:(NSNotification*)notification { |
+ [self saveWindowPositionIfNeeded]; |
+ |
// Resize (and possibly move) the status bubble. Note that we may get called |
// when the status bubble does not exist. |
if (statusBubble_) { |
@@ -1803,6 +1804,8 @@ enum { |
// |-windowWillMove:|, which is called less frequently than |-windowDidMove| |
// instead.) |
- (void)windowDidMove:(NSNotification*)notification { |
+ [self saveWindowPositionIfNeeded]; |
+ |
NSWindow* window = [self window]; |
NSRect windowFrame = [window frame]; |
NSRect workarea = [[window screen] visibleFrame]; |