Chromium Code Reviews| Index: chrome/browser/ui/cocoa/framed_browser_window.mm |
| diff --git a/chrome/browser/ui/cocoa/framed_browser_window.mm b/chrome/browser/ui/cocoa/framed_browser_window.mm |
| index 0989b6a543f296e73e36b5b2484fd6ef7cd14ef1..aa61305dd72ebc43020be7af786f4d5c1e16f72b 100644 |
| --- a/chrome/browser/ui/cocoa/framed_browser_window.mm |
| +++ b/chrome/browser/ui/cocoa/framed_browser_window.mm |
| @@ -5,6 +5,7 @@ |
| #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| #include "base/logging.h" |
| +#include "base/mac/mac_util.h" |
| #include "base/mac/sdk_forward_declarations.h" |
| #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| @@ -36,7 +37,7 @@ const CGFloat kWindowGradientHeight = 24.0; |
| } |
| -@interface FramedBrowserWindow (Private) |
| +@interface FramedBrowserWindow () |
| - (void)adjustCloseButton:(NSNotification*)notification; |
| - (void)adjustMiniaturizeButton:(NSNotification*)notification; |
| @@ -252,11 +253,18 @@ const CGFloat kWindowGradientHeight = 24.0; |
| } |
| - (void)setShouldHideTitle:(BOOL)flag { |
| - shouldHideTitle_ = flag; |
| + if ([self respondsToSelector:@selector(setTitleVisibility:)]) |
| + self.titleVisibility = flag ? NSWindowTitleHidden : NSWindowTitleVisible; |
| + else |
| + shouldHideTitle_ = flag; |
| } |
| - (BOOL)_isTitleHidden { |
| - return shouldHideTitle_; |
| + // Only intervene with 10.6-10.9. |
| + if ([self respondsToSelector:@selector(setTitleVisibility:)]) |
| + return [super _isTitleHidden]; |
| + else |
| + return shouldHideTitle_; |
| } |
| - (CGFloat)windowButtonsInterButtonSpacing { |
| @@ -349,9 +357,12 @@ const CGFloat kWindowGradientHeight = 24.0; |
| bounds:windowRect |
| forceBlackBackground:NO]; |
| - // If the window needs a title and we painted over the title as drawn by the |
| - // default window paint, paint it ourselves. |
| - if (themed && [view respondsToSelector:@selector(_titlebarTitleRect)] && |
| + // In Yosemite: The title is drawn by a subview and not painted on. Therefore, |
| + // never worry about drawing it. Pre-Yosemite: If the window needs a title and |
| + // we painted over the title as drawn by the default window paint, paint it |
| + // ourselves. |
| + if (base::mac::IsOSMavericksOrEarlier() && |
|
Mark Mentovai
2014/06/12 18:27:14
Ask if the window doesn’t respond to the selector
Avi (use Gerrit)
2014/06/12 18:30:31
Done.
|
| + themed && [view respondsToSelector:@selector(_titlebarTitleRect)] && |
| [view respondsToSelector:@selector(_drawTitleStringIn:withColor:)] && |
| ![self _isTitleHidden]) { |
| [view _drawTitleStringIn:[view _titlebarTitleRect] |