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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_window_controller.mm

Issue 611453004: Mac: Fix theme image drawing when building with >=10.9 SDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment for Avi Created 6 years, 3 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 | « chrome/browser/ui/cocoa/tabs/tab_window_controller.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
index 103c740d49970350b4a33c23d30aee692021056e..b5069cb862f85d692f195ce06f9ca0fefd9026bd 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
@@ -8,6 +8,7 @@
#import "chrome/browser/ui/cocoa/browser_window_layout.h"
#import "chrome/browser/ui/cocoa/fast_resize_view.h"
#import "chrome/browser/ui/cocoa/framed_browser_window.h"
+#import "chrome/browser/ui/cocoa/tabs/tab_strip_background_view.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
#import "chrome/browser/ui/cocoa/version_independent_window.h"
@@ -52,7 +53,6 @@
base::scoped_nsobject<FramedBrowserWindow> window(
[[FramedBrowserWindow alloc] initWithContentRect:contentRect
hasTabStrip:hasTabStrip]);
- [self moveContentViewToBack:[window contentView]];
[window setReleasedWhenClosed:YES];
[window setAutorecalculatesKeyViewLoop:YES];
@@ -65,6 +65,25 @@
NSViewHeightSizable];
[[[self window] contentView] addSubview:tabContentArea_];
+ // tabStripBackgroundView_ draws the theme image behind the tab strip area.
+ // When making a tab dragging window (setUseOverlay:), this view stays in
+ // the parent window so that it can be translucent, while the tab strip view
+ // moves to the child window and stays opaque.
+ NSView* windowView = [window cr_windowView];
+ tabStripBackgroundView_.reset([[TabStripBackgroundView alloc]
+ initWithFrame:NSMakeRect(0,
+ NSMaxY([windowView bounds]) -
+ kBrowserFrameViewPaintHeight,
+ NSWidth([windowView bounds]),
+ kBrowserFrameViewPaintHeight)]);
+ [tabStripBackgroundView_
+ setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
+ [windowView addSubview:tabStripBackgroundView_
+ positioned:NSWindowBelow
+ relativeTo:nil];
+
+ [self moveContentViewToBack:[window contentView]];
+
tabStripView_.reset([[TabStripView alloc]
initWithFrame:NSMakeRect(0, 0, 750, chrome::kTabStripHeight)]);
[tabStripView_ setAutoresizingMask:NSViewWidthSizable |
@@ -75,6 +94,10 @@
return self;
}
+- (NSView*)tabStripBackgroundView {
+ return tabStripBackgroundView_;
+}
+
- (TabStripView*)tabStripView {
return tabStripView_;
}
@@ -289,7 +312,14 @@
base::scoped_nsobject<NSView> contentView([cv retain]);
NSView* superview = [contentView superview];
[contentView removeFromSuperview];
- [superview addSubview:contentView positioned:NSWindowBelow relativeTo:nil];
+ DCHECK(tabStripBackgroundView_);
+ if (superview == [tabStripBackgroundView_ superview]) {
+ [superview addSubview:contentView
+ positioned:NSWindowAbove
+ relativeTo:tabStripBackgroundView_];
+ } else {
+ [superview addSubview:contentView positioned:NSWindowBelow relativeTo:nil];
+ }
}
- (void)insertTabStripView:(NSView*)tabStripView intoWindow:(NSWindow*)window {
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_window_controller.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698