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 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 | |
|
erikchen
2015/08/10 18:06:26
grammar.
This method is overridden to prevent App
spqchan1
2015/08/11 21:43:48
Done.
| |
| 106 // the style mask | |
| 107 - (void)setStyleMask:(NSUInteger)styleMask { | |
|
erikchen
2015/08/10 18:06:26
reformat this method to meet Chrome style guidelin
spqchan1
2015/08/11 21:43:48
ditto to below.
| |
| 108 if (frameAndStyleLock_) { | |
| 109 return; | |
|
erikchen
2015/08/10 18:06:25
This is, in general, a very dangerous operation. I
spqchan1
2015/08/11 21:43:48
Done.
| |
| 110 } | |
| 111 [super setStyleMask:styleMask]; | |
| 112 } | |
| 113 | |
| 114 // Overriding this method to prevent the OSX from automatically setting | |
|
erikchen
2015/08/10 18:06:26
ditto
spqchan1
2015/08/11 21:43:48
Done.
| |
| 115 // the frame | |
| 116 - (void)setFrame:(NSRect)frameRect | |
| 117 display:(BOOL)flag | |
| 118 animate:(BOOL)animateFlag { | |
|
erikchen
2015/08/10 18:06:26
reformat this method to meet Chrome style guidelin
spqchan1
2015/08/11 21:43:48
I moved the overriden methods to the top. I'm conf
erikchen
2015/08/11 22:42:54
The rest of the method is formatted incorrectly. T
spqchan1
2015/08/12 19:34:41
Done. Removed the curly brace
| |
| 119 if (frameAndStyleLock_) { | |
| 120 return; | |
| 121 } | |
| 122 [super setFrame:frameRect display:flag animate:animateFlag]; | |
| 123 } | |
| 124 | |
| 105 - (void)dealloc { | 125 - (void)dealloc { |
| 106 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 126 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 107 [super dealloc]; | 127 [super dealloc]; |
| 108 } | 128 } |
| 109 | 129 |
| 110 - (void)adjustCloseButton:(NSNotification*)notification { | 130 - (void)adjustCloseButton:(NSNotification*)notification { |
| 111 [self adjustButton:[notification object] | 131 [self adjustButton:[notification object] |
| 112 ofKind:NSWindowCloseButton]; | 132 ofKind:NSWindowCloseButton]; |
| 113 } | 133 } |
| 114 | 134 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 if (!value) { | 190 if (!value) { |
| 171 value = [super accessibilityHitTest:point]; | 191 value = [super accessibilityHitTest:point]; |
| 172 } | 192 } |
| 173 return value; | 193 return value; |
| 174 } | 194 } |
| 175 | 195 |
| 176 - (void)setShouldHideTitle:(BOOL)flag { | 196 - (void)setShouldHideTitle:(BOOL)flag { |
| 177 shouldHideTitle_ = flag; | 197 shouldHideTitle_ = flag; |
| 178 } | 198 } |
| 179 | 199 |
| 200 // This method sets a lock which prevents the the frame and style | |
| 201 // of the window to be changed | |
| 202 - (void) setFrameAndStyleLock:(BOOL)lock { | |
|
erikchen
2015/08/10 18:06:26
run "git cl format" to clang-format your entire CL
spqchan1
2015/08/11 21:43:48
Done. This is magical
| |
| 203 frameAndStyleLock_ = lock; | |
| 204 } | |
| 205 | |
| 180 - (BOOL)_isTitleHidden { | 206 - (BOOL)_isTitleHidden { |
| 181 return shouldHideTitle_; | 207 return shouldHideTitle_; |
| 182 } | 208 } |
| 183 | 209 |
| 184 - (CGFloat)windowButtonsInterButtonSpacing { | 210 - (CGFloat)windowButtonsInterButtonSpacing { |
| 185 return windowButtonsInterButtonSpacing_; | 211 return windowButtonsInterButtonSpacing_; |
| 186 } | 212 } |
| 187 | 213 |
| 188 // This method is called whenever a window is moved in order to ensure it fits | 214 // 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 | 215 // 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]; | 364 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
| 339 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 365 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
| 340 | 366 |
| 341 if (incognito) | 367 if (incognito) |
| 342 return [NSColor whiteColor]; | 368 return [NSColor whiteColor]; |
| 343 else | 369 else |
| 344 return [NSColor windowFrameTextColor]; | 370 return [NSColor windowFrameTextColor]; |
| 345 } | 371 } |
| 346 | 372 |
| 347 @end | 373 @end |
| OLD | NEW |