Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7824)

Unified Diff: chrome/browser/ui/cocoa/chrome_browser_window.mm

Issue 1955343002: Mac: Use a "less" private API for keeping traffic lights lit while bubbles are showing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160509-MacViews-HasActiveAppearance-upstream
Patch Set: Add a comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/cocoa/native_widget_mac_nswindow.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/chrome_browser_window.mm
diff --git a/chrome/browser/ui/cocoa/chrome_browser_window.mm b/chrome/browser/ui/cocoa/chrome_browser_window.mm
index 4f12cda64c98aba999a2426561aefb03589afbcf..e9894b36ce691eeb6445bb8c4415253452c16b99 100644
--- a/chrome/browser/ui/cocoa/chrome_browser_window.mm
+++ b/chrome/browser/ui/cocoa/chrome_browser_window.mm
@@ -9,6 +9,10 @@
#import "chrome/browser/ui/cocoa/themed_window.h"
#include "ui/base/theme_provider.h"
+@interface NSWindow (Private)
+- (BOOL)hasKeyAppearance;
+@end
+
@implementation ChromeBrowserWindow
- (const ui::ThemeProvider*)themeProvider {
@@ -80,4 +84,22 @@
return NO;
}
+- (BOOL)hasKeyAppearance {
+ // If not key, but a non-main child window without its own traffic lights _is_
+ // key, then show this window with key appearance to keep the traffic lights
+ // lit. This does not currently handle WebModal dialogs, since they are
+ // children of an overlay window. But WebModals also temporarily lose key
+ // status while animating closed, so extra logic is needed to avoid flicker.
+ // Start with an early exit, since this is called for every mouseMove and
+ // every cursor blink in an NSTextField.
+ if (![self isKeyWindow]) {
+ for (NSWindow* child in [self childWindows]) {
+ if ([child isKeyWindow] && ![child isMainWindow] &&
+ ([child styleMask] & NSClosableWindowMask) == 0)
+ return YES;
+ }
+ }
+ return [super hasKeyAppearance];
+}
+
@end
« no previous file with comments | « no previous file | ui/views/cocoa/native_widget_mac_nswindow.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698