| 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/ui/cocoa/framed_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
| 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 - (void)adjustMiniaturizeButton:(NSNotification*)notification; | 39 - (void)adjustMiniaturizeButton:(NSNotification*)notification; |
| 40 - (void)adjustZoomButton:(NSNotification*)notification; | 40 - (void)adjustZoomButton:(NSNotification*)notification; |
| 41 - (void)adjustButton:(NSButton*)button | 41 - (void)adjustButton:(NSButton*)button |
| 42 ofKind:(NSWindowButton)kind; | 42 ofKind:(NSWindowButton)kind; |
| 43 | 43 |
| 44 @end | 44 @end |
| 45 | 45 |
| 46 @implementation FramedBrowserWindow | 46 @implementation FramedBrowserWindow |
| 47 | 47 |
| 48 - (void)setStyleMask:(NSUInteger)styleMask { | 48 - (void)setStyleMask:(NSUInteger)styleMask { |
| 49 if (frameAndStyleMaskLock_) | 49 if (styleMaskLock_) |
| 50 return; | 50 return; |
| 51 [super setStyleMask:styleMask]; | 51 [super setStyleMask:styleMask]; |
| 52 } | 52 } |
| 53 | 53 |
| 54 - (void)setFrame:(NSRect)windowFrame | |
| 55 display:(BOOL)displayViews | |
| 56 animate:(BOOL)performAnimation { | |
| 57 if (frameAndStyleMaskLock_) | |
| 58 return; | |
| 59 [super setFrame:windowFrame display:displayViews animate:performAnimation]; | |
| 60 } | |
| 61 | |
| 62 - (id)initWithContentRect:(NSRect)contentRect | 54 - (id)initWithContentRect:(NSRect)contentRect |
| 63 hasTabStrip:(BOOL)hasTabStrip{ | 55 hasTabStrip:(BOOL)hasTabStrip{ |
| 64 NSUInteger styleMask = NSTitledWindowMask | | 56 NSUInteger styleMask = NSTitledWindowMask | |
| 65 NSClosableWindowMask | | 57 NSClosableWindowMask | |
| 66 NSMiniaturizableWindowMask | | 58 NSMiniaturizableWindowMask | |
| 67 NSResizableWindowMask | | 59 NSResizableWindowMask | |
| 68 NSTexturedBackgroundWindowMask; | 60 NSTexturedBackgroundWindowMask; |
| 69 if ((self = [super initWithContentRect:contentRect | 61 if ((self = [super initWithContentRect:contentRect |
| 70 styleMask:styleMask | 62 styleMask:styleMask |
| 71 backing:NSBackingStoreBuffered | 63 backing:NSBackingStoreBuffered |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 name:NSViewFrameDidChangeNotification | 96 name:NSViewFrameDidChangeNotification |
| 105 object:closeButton_]; | 97 object:closeButton_]; |
| 106 [center addObserver:self | 98 [center addObserver:self |
| 107 selector:@selector(adjustMiniaturizeButton:) | 99 selector:@selector(adjustMiniaturizeButton:) |
| 108 name:NSViewFrameDidChangeNotification | 100 name:NSViewFrameDidChangeNotification |
| 109 object:miniaturizeButton_]; | 101 object:miniaturizeButton_]; |
| 110 [center addObserver:self | 102 [center addObserver:self |
| 111 selector:@selector(adjustZoomButton:) | 103 selector:@selector(adjustZoomButton:) |
| 112 name:NSViewFrameDidChangeNotification | 104 name:NSViewFrameDidChangeNotification |
| 113 object:zoomButton_]; | 105 object:zoomButton_]; |
| 114 | |
| 115 frameAndStyleMaskLock_ = NO; | |
| 116 } | 106 } |
| 117 | 107 |
| 118 return self; | 108 return self; |
| 119 } | 109 } |
| 120 | 110 |
| 121 - (void)dealloc { | 111 - (void)dealloc { |
| 122 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 112 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 123 [super dealloc]; | 113 [super dealloc]; |
| 124 } | 114 } |
| 125 | 115 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 if (!value) { | 176 if (!value) { |
| 187 value = [super accessibilityHitTest:point]; | 177 value = [super accessibilityHitTest:point]; |
| 188 } | 178 } |
| 189 return value; | 179 return value; |
| 190 } | 180 } |
| 191 | 181 |
| 192 - (void)setShouldHideTitle:(BOOL)flag { | 182 - (void)setShouldHideTitle:(BOOL)flag { |
| 193 shouldHideTitle_ = flag; | 183 shouldHideTitle_ = flag; |
| 194 } | 184 } |
| 195 | 185 |
| 196 - (void)setFrameAndStyleMaskLock:(BOOL)lock { | 186 - (void)setStyleMaskLock:(BOOL)lock { |
| 197 frameAndStyleMaskLock_ = lock; | 187 styleMaskLock_ = lock; |
| 198 } | 188 } |
| 199 | 189 |
| 200 - (BOOL)_isTitleHidden { | 190 - (BOOL)_isTitleHidden { |
| 201 return shouldHideTitle_; | 191 return shouldHideTitle_; |
| 202 } | 192 } |
| 203 | 193 |
| 204 - (CGFloat)windowButtonsInterButtonSpacing { | 194 - (CGFloat)windowButtonsInterButtonSpacing { |
| 205 return windowButtonsInterButtonSpacing_; | 195 return windowButtonsInterButtonSpacing_; |
| 206 } | 196 } |
| 207 | 197 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 ThemedWindowStyle windowStyle = [self themedWindowStyle]; | 348 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
| 359 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 349 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
| 360 | 350 |
| 361 if (incognito) | 351 if (incognito) |
| 362 return [NSColor whiteColor]; | 352 return [NSColor whiteColor]; |
| 363 else | 353 else |
| 364 return [NSColor windowFrameTextColor]; | 354 return [NSColor windowFrameTextColor]; |
| 365 } | 355 } |
| 366 | 356 |
| 367 @end | 357 @end |
| OLD | NEW |