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

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

Issue 900613003: Mac: Make it easier for views to correctly draw with a theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gyp
Patch Set: Created 5 years, 11 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
Index: chrome/browser/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index dbc7b22d98572492352553f117703162875549e1..151ae0e4109abbbecd42ec0c2c274efd17d228fc 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -619,26 +619,20 @@ using content::WebContents;
BrowserList::SetLastActive(browser_.get());
[self saveWindowPositionIfNeeded];
- // TODO(dmaclach): Instead of redrawing the whole window, views that care
- // about the active window state should be registering for notifications.
- [[self window] setViewsNeedDisplay:YES];
Andre 2015/02/03 19:00:20 I think there's a misunderstanding here. setViewsN
-
- // TODO(viettrungluu): For some reason, the above doesn't suffice.
- if ([self isInAnyFullscreenMode])
- [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil.
Andre 2015/02/03 19:00:20 FloatingBarBackingView now adopts ThemedWindowDraw
+ [[[self window] contentView] cr_recursivelyInvokeBlock:^(id view) {
+ if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)])
+ [view windowDidChangeActive];
+ }];
extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())
->set_registry_for_active_window(extension_keybinding_registry_.get());
}
- (void)windowDidResignMain:(NSNotification*)notification {
- // TODO(dmaclach): Instead of redrawing the whole window, views that care
- // about the active window state should be registering for notifications.
- [[self window] setViewsNeedDisplay:YES];
-
- // TODO(viettrungluu): For some reason, the above doesn't suffice.
- if ([self isInAnyFullscreenMode])
- [floatingBarBackingView_ setNeedsDisplay:YES]; // Okay even if nil.
+ [[[self window] contentView] cr_recursivelyInvokeBlock:^(id view) {
+ if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)])
+ [view windowDidChangeActive];
+ }];
extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())
->set_registry_for_active_window(nullptr);
@@ -1702,7 +1696,15 @@ using content::WebContents;
}
- (void)userChangedTheme {
- [[[[self window] contentView] superview] cr_recursivelySetNeedsDisplay:YES];
+ NSView* rootView = [[[self window] contentView] superview];
+ [rootView cr_recursivelyInvokeBlock:^(id view) {
+ if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)])
+ [view windowDidChangeTheme];
+
+ // TODO(andresantoso): Remove this once all themed views respond to
+ // windowDidChangeTheme above.
+ [view setNeedsDisplay:YES];
+ }];
}
- (ui::ThemeProvider*)themeProvider {

Powered by Google App Engine
This is Rietveld 408576698