| 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 27 matching lines...) Expand all Loading... |
| 38 - (void)adjustCloseButton:(NSNotification*)notification; | 38 - (void)adjustCloseButton:(NSNotification*)notification; |
| 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 { |
| 49 if (frameAndStyleMaskLock_) |
| 50 return; |
| 51 [super setStyleMask:styleMask]; |
| 52 } |
| 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 |
| 48 - (id)initWithContentRect:(NSRect)contentRect | 62 - (id)initWithContentRect:(NSRect)contentRect |
| 49 hasTabStrip:(BOOL)hasTabStrip{ | 63 hasTabStrip:(BOOL)hasTabStrip{ |
| 50 NSUInteger styleMask = NSTitledWindowMask | | 64 NSUInteger styleMask = NSTitledWindowMask | |
| 51 NSClosableWindowMask | | 65 NSClosableWindowMask | |
| 52 NSMiniaturizableWindowMask | | 66 NSMiniaturizableWindowMask | |
| 53 NSResizableWindowMask | | 67 NSResizableWindowMask | |
| 54 NSTexturedBackgroundWindowMask; | 68 NSTexturedBackgroundWindowMask; |
| 55 if ((self = [super initWithContentRect:contentRect | 69 if ((self = [super initWithContentRect:contentRect |
| 56 styleMask:styleMask | 70 styleMask:styleMask |
| 57 backing:NSBackingStoreBuffered | 71 backing:NSBackingStoreBuffered |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 name:NSViewFrameDidChangeNotification | 104 name:NSViewFrameDidChangeNotification |
| 91 object:closeButton_]; | 105 object:closeButton_]; |
| 92 [center addObserver:self | 106 [center addObserver:self |
| 93 selector:@selector(adjustMiniaturizeButton:) | 107 selector:@selector(adjustMiniaturizeButton:) |
| 94 name:NSViewFrameDidChangeNotification | 108 name:NSViewFrameDidChangeNotification |
| 95 object:miniaturizeButton_]; | 109 object:miniaturizeButton_]; |
| 96 [center addObserver:self | 110 [center addObserver:self |
| 97 selector:@selector(adjustZoomButton:) | 111 selector:@selector(adjustZoomButton:) |
| 98 name:NSViewFrameDidChangeNotification | 112 name:NSViewFrameDidChangeNotification |
| 99 object:zoomButton_]; | 113 object:zoomButton_]; |
| 114 |
| 115 frameAndStyleMaskLock_ = NO; |
| 100 } | 116 } |
| 101 | 117 |
| 102 return self; | 118 return self; |
| 103 } | 119 } |
| 104 | 120 |
| 105 - (void)dealloc { | 121 - (void)dealloc { |
| 106 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 122 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 107 [super dealloc]; | 123 [super dealloc]; |
| 108 } | 124 } |
| 109 | 125 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (!value) { | 186 if (!value) { |
| 171 value = [super accessibilityHitTest:point]; | 187 value = [super accessibilityHitTest:point]; |
| 172 } | 188 } |
| 173 return value; | 189 return value; |
| 174 } | 190 } |
| 175 | 191 |
| 176 - (void)setShouldHideTitle:(BOOL)flag { | 192 - (void)setShouldHideTitle:(BOOL)flag { |
| 177 shouldHideTitle_ = flag; | 193 shouldHideTitle_ = flag; |
| 178 } | 194 } |
| 179 | 195 |
| 196 - (void)setFrameAndStyleMaskLock:(BOOL)lock { |
| 197 frameAndStyleMaskLock_ = lock; |
| 198 } |
| 199 |
| 180 - (BOOL)_isTitleHidden { | 200 - (BOOL)_isTitleHidden { |
| 181 return shouldHideTitle_; | 201 return shouldHideTitle_; |
| 182 } | 202 } |
| 183 | 203 |
| 184 - (CGFloat)windowButtonsInterButtonSpacing { | 204 - (CGFloat)windowButtonsInterButtonSpacing { |
| 185 return windowButtonsInterButtonSpacing_; | 205 return windowButtonsInterButtonSpacing_; |
| 186 } | 206 } |
| 187 | 207 |
| 188 // This method is called whenever a window is moved in order to ensure it fits | 208 // This method is called whenever a window is moved in order to ensure it fits |
| 189 // on the screen. We cannot always handle resizes without breaking, so we | 209 // on the screen. We cannot always handle resizes without breaking, so we |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 ThemedWindowStyle windowStyle = [self themedWindowStyle]; | 358 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
| 339 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 359 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
| 340 | 360 |
| 341 if (incognito) | 361 if (incognito) |
| 342 return [NSColor whiteColor]; | 362 return [NSColor whiteColor]; |
| 343 else | 363 else |
| 344 return [NSColor windowFrameTextColor]; | 364 return [NSColor windowFrameTextColor]; |
| 345 } | 365 } |
| 346 | 366 |
| 347 @end | 367 @end |
| OLD | NEW |