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/scoped_nsobject.h" |
8 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 10 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 11 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
12 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 13 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
13 #import "chrome/browser/ui/cocoa/custom_frame_view.h" | 14 #import "chrome/browser/ui/cocoa/custom_frame_view.h" |
14 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 15 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
15 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 16 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
16 #import "chrome/browser/ui/cocoa/themed_window.h" | 17 #import "chrome/browser/ui/cocoa/themed_window.h" |
17 #include "chrome/browser/themes/theme_properties.h" | 18 #include "chrome/browser/themes/theme_properties.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 hasTabStrip:(BOOL)hasTabStrip{ | 66 hasTabStrip:(BOOL)hasTabStrip{ |
66 NSUInteger styleMask = NSTitledWindowMask | | 67 NSUInteger styleMask = NSTitledWindowMask | |
67 NSClosableWindowMask | | 68 NSClosableWindowMask | |
68 NSMiniaturizableWindowMask | | 69 NSMiniaturizableWindowMask | |
69 NSResizableWindowMask | | 70 NSResizableWindowMask | |
70 NSTexturedBackgroundWindowMask; | 71 NSTexturedBackgroundWindowMask; |
71 if ((self = [super initWithContentRect:contentRect | 72 if ((self = [super initWithContentRect:contentRect |
72 styleMask:styleMask | 73 styleMask:styleMask |
73 backing:NSBackingStoreBuffered | 74 backing:NSBackingStoreBuffered |
74 defer:YES])) { | 75 defer:YES])) { |
| 76 // In Yosemite, no views can be in front of the traffic lights controls in |
| 77 // the top left of the window. This affects both the content view and the |
| 78 // tab strip view. The tab strip is added directly above the content view, |
| 79 // so moving the content view to the back fixes the problem. |
| 80 base::scoped_nsobject<NSView> contentView([[self contentView] retain]); |
| 81 NSView* superview = [contentView superview]; |
| 82 [contentView removeFromSuperview]; |
| 83 [superview addSubview:contentView positioned:NSWindowBelow relativeTo:nil]; |
| 84 |
75 // The 10.6 fullscreen code copies the title to a different window, which | 85 // The 10.6 fullscreen code copies the title to a different window, which |
76 // will assert if it's nil. | 86 // will assert if it's nil. |
77 [self setTitle:@""]; | 87 [self setTitle:@""]; |
78 | 88 |
79 // The following two calls fix http://crbug.com/25684 by preventing the | 89 // The following two calls fix http://crbug.com/25684 by preventing the |
80 // window from recalculating the border thickness as the window is | 90 // window from recalculating the border thickness as the window is |
81 // resized. | 91 // resized. |
82 // This was causing the window tint to change for the default system theme | 92 // This was causing the window tint to change for the default system theme |
83 // when the window was being resized. | 93 // when the window was being resized. |
84 [self setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; | 94 [self setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 ThemedWindowStyle windowStyle = [self themedWindowStyle]; | 497 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
488 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 498 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
489 | 499 |
490 if (incognito) | 500 if (incognito) |
491 return [NSColor whiteColor]; | 501 return [NSColor whiteColor]; |
492 else | 502 else |
493 return [NSColor windowFrameTextColor]; | 503 return [NSColor windowFrameTextColor]; |
494 } | 504 } |
495 | 505 |
496 @end | 506 @end |
OLD | NEW |