| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 object:miniaturizeButton_]; | 95 object:miniaturizeButton_]; |
| 96 [center addObserver:self | 96 [center addObserver:self |
| 97 selector:@selector(adjustZoomButton:) | 97 selector:@selector(adjustZoomButton:) |
| 98 name:NSViewFrameDidChangeNotification | 98 name:NSViewFrameDidChangeNotification |
| 99 object:zoomButton_]; | 99 object:zoomButton_]; |
| 100 } | 100 } |
| 101 | 101 |
| 102 return self; | 102 return self; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Overriding this method to prevent the OSX from automatically setting |
| 106 // the style mask |
| 107 - (void)setStyleMask:(NSUInteger)styleMask { |
| 108 if (frameAndStyleLock_) { |
| 109 return; |
| 110 } |
| 111 [super setStyleMask:styleMask]; |
| 112 } |
| 113 |
| 114 // Overriding this method to prevent the OSX from automatically setting |
| 115 // the frame |
| 116 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag animate:(BOOL)animateFlag
{ |
| 117 if (frameAndStyleLock_) { |
| 118 return; |
| 119 } |
| 120 [super setFrame:frameRect display:flag animate:animateFlag]; |
| 121 } |
| 122 |
| 105 - (void)dealloc { | 123 - (void)dealloc { |
| 106 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 124 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 107 [super dealloc]; | 125 [super dealloc]; |
| 108 } | 126 } |
| 109 | 127 |
| 110 - (void)adjustCloseButton:(NSNotification*)notification { | 128 - (void)adjustCloseButton:(NSNotification*)notification { |
| 111 [self adjustButton:[notification object] | 129 [self adjustButton:[notification object] |
| 112 ofKind:NSWindowCloseButton]; | 130 ofKind:NSWindowCloseButton]; |
| 113 } | 131 } |
| 114 | 132 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (!value) { | 188 if (!value) { |
| 171 value = [super accessibilityHitTest:point]; | 189 value = [super accessibilityHitTest:point]; |
| 172 } | 190 } |
| 173 return value; | 191 return value; |
| 174 } | 192 } |
| 175 | 193 |
| 176 - (void)setShouldHideTitle:(BOOL)flag { | 194 - (void)setShouldHideTitle:(BOOL)flag { |
| 177 shouldHideTitle_ = flag; | 195 shouldHideTitle_ = flag; |
| 178 } | 196 } |
| 179 | 197 |
| 198 // This method sets a lock which prevents the the frame and style |
| 199 // of the window to be changed |
| 200 - (void) setFrameAndStyleLock:(BOOL)lock { |
| 201 frameAndStyleLock_ = lock; |
| 202 } |
| 203 |
| 180 - (BOOL)_isTitleHidden { | 204 - (BOOL)_isTitleHidden { |
| 181 return shouldHideTitle_; | 205 return shouldHideTitle_; |
| 182 } | 206 } |
| 183 | 207 |
| 184 - (CGFloat)windowButtonsInterButtonSpacing { | 208 - (CGFloat)windowButtonsInterButtonSpacing { |
| 185 return windowButtonsInterButtonSpacing_; | 209 return windowButtonsInterButtonSpacing_; |
| 186 } | 210 } |
| 187 | 211 |
| 188 // This method is called whenever a window is moved in order to ensure it fits | 212 // 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 | 213 // 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]; | 362 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
| 339 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 363 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
| 340 | 364 |
| 341 if (incognito) | 365 if (incognito) |
| 342 return [NSColor whiteColor]; | 366 return [NSColor whiteColor]; |
| 343 else | 367 else |
| 344 return [NSColor windowFrameTextColor]; | 368 return [NSColor windowFrameTextColor]; |
| 345 } | 369 } |
| 346 | 370 |
| 347 @end | 371 @end |
| OLD | NEW |