Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 106 |
| 115 frameAndStyleMaskLock_ = NO; | 107 styleMaskLock_ = NO; |
|
erikchen
2015/11/09 18:29:21
unnecessary.
spqchan
2015/11/09 22:27:19
Done.
| |
| 116 } | 108 } |
| 117 | 109 |
| 118 return self; | 110 return self; |
| 119 } | 111 } |
| 120 | 112 |
| 121 - (void)dealloc { | 113 - (void)dealloc { |
| 122 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 114 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 123 [super dealloc]; | 115 [super dealloc]; |
| 124 } | 116 } |
| 125 | 117 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 if (!value) { | 178 if (!value) { |
| 187 value = [super accessibilityHitTest:point]; | 179 value = [super accessibilityHitTest:point]; |
| 188 } | 180 } |
| 189 return value; | 181 return value; |
| 190 } | 182 } |
| 191 | 183 |
| 192 - (void)setShouldHideTitle:(BOOL)flag { | 184 - (void)setShouldHideTitle:(BOOL)flag { |
| 193 shouldHideTitle_ = flag; | 185 shouldHideTitle_ = flag; |
| 194 } | 186 } |
| 195 | 187 |
| 196 - (void)setFrameAndStyleMaskLock:(BOOL)lock { | 188 - (void)setStyleMaskLock:(BOOL)lock { |
| 197 frameAndStyleMaskLock_ = lock; | 189 styleMaskLock_ = lock; |
| 198 } | 190 } |
| 199 | 191 |
| 200 - (BOOL)_isTitleHidden { | 192 - (BOOL)_isTitleHidden { |
| 201 return shouldHideTitle_; | 193 return shouldHideTitle_; |
| 202 } | 194 } |
| 203 | 195 |
| 204 - (CGFloat)windowButtonsInterButtonSpacing { | 196 - (CGFloat)windowButtonsInterButtonSpacing { |
| 205 return windowButtonsInterButtonSpacing_; | 197 return windowButtonsInterButtonSpacing_; |
| 206 } | 198 } |
| 207 | 199 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 ThemedWindowStyle windowStyle = [self themedWindowStyle]; | 350 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
| 359 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 351 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
| 360 | 352 |
| 361 if (incognito) | 353 if (incognito) |
| 362 return [NSColor whiteColor]; | 354 return [NSColor whiteColor]; |
| 363 else | 355 else |
| 364 return [NSColor windowFrameTextColor]; | 356 return [NSColor windowFrameTextColor]; |
| 365 } | 357 } |
| 366 | 358 |
| 367 @end | 359 @end |
| OLD | NEW |