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

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

Issue 2360343003: cocoa browser: remove non-material tabstrip support (Closed)
Patch Set: restyle fn Created 4 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
Index: chrome/browser/ui/cocoa/tabs/tab_view.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm
index 274e5f9764cd7d377b120afaf957e34a72a49c68..5936812438ff60760d89d8a7916e12f66f28279a 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_view.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm
@@ -82,11 +82,6 @@ - (HoverCloseButton*)closeButton;
};
NSImage* imageForResourceID(int resource_id, StrokeType stroke_type) {
- if (!ui::MaterialDesignController::IsModeMaterial()) {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- return [rb.GetNativeImageNamed(resource_id).CopyNSImage() autorelease];
- }
-
CGFloat imageWidth = resource_id == IDR_TAB_ACTIVE_CENTER ? 1 : 18;
SEL theSelector = 0;
switch (resource_id) {
@@ -136,14 +131,6 @@ - (HoverCloseButton*)closeButton;
}
ui::ThreePartImage& GetStrokeImage(bool active, StrokeType stroke_type) {
- if (!ui::MaterialDesignController::IsModeMaterial() && !active) {
- CR_DEFINE_STATIC_LOCAL(
- ui::ThreePartImage, inactiveStroke,
- (imageForResourceID(IDR_TAB_INACTIVE_LEFT, STROKE_NORMAL),
- imageForResourceID(IDR_TAB_INACTIVE_CENTER, STROKE_NORMAL),
- imageForResourceID(IDR_TAB_INACTIVE_RIGHT, STROKE_NORMAL)));
- return inactiveStroke;
- }
CR_DEFINE_STATIC_LOCAL(
ui::ThreePartImage, stroke,
(imageForResourceID(IDR_TAB_ACTIVE_LEFT, STROKE_NORMAL),
@@ -202,11 +189,6 @@ - (id)initWithFrame:(NSRect)frame
base::scoped_nsobject<GTMFadeTruncatingTextFieldCell> labelCell(
[[GTMFadeTruncatingTextFieldCell alloc] initTextCell:@"Label"]);
[labelCell setControlSize:NSSmallControlSize];
- // Font size is 12, per Material Design spec.
- CGFloat fontSize = 12;
- if (!ui::MaterialDesignController::IsModeMaterial()) {
- fontSize = [NSFont systemFontSizeForControlSize:NSSmallControlSize];
- }
[titleView_ setCell:labelCell];
titleViewCell_ = labelCell;
@@ -428,9 +410,6 @@ - (void)drawFill:(NSRect)dirtyRect {
// Background tabs should not paint over the tab strip separator, which is
// two pixels high in both lodpi and hidpi, and one pixel high in MD.
CGFloat tabStripSeparatorLineWidth = [self cr_lineWidth];
- if (!ui::MaterialDesignController::IsModeMaterial()) {
- tabStripSeparatorLineWidth *= 2;
- }
clippingRect.origin.y = tabStripSeparatorLineWidth;
clippingRect.size.height -= tabStripSeparatorLineWidth;
}
@@ -486,9 +465,8 @@ - (void)drawGlow:(NSRect)dirtyRect {
if (hoverAlpha > 0) {
if (themeProvider && !hasCustomTheme) {
CGFloat whiteValue = 1;
- // In MD Incognito mode, give the glow a darker value.
- if (ui::MaterialDesignController::IsModeMaterial() && themeProvider
- && themeProvider->InIncognitoMode()) {
+ // In Incognito mode, give the glow a darker value.
+ if (themeProvider && themeProvider->InIncognitoMode()) {
whiteValue = 0.5;
}
base::scoped_nsobject<NSGradient> glow([NSGradient alloc]);
@@ -513,17 +491,14 @@ - (void)drawGlow:(NSRect)dirtyRect {
// Draws the tab outline.
- (void)drawStroke:(NSRect)dirtyRect {
- CGFloat alpha = [[self window] isMainWindow] ? 1.0 : tabs::kImageNoFocusAlpha;
+ // In MD, the tab stroke is always opaque.
+ CGFloat alpha = 1;
NSRect bounds = [self bounds];
- if (ui::MaterialDesignController::IsModeMaterial()) {
- // In Material Design the tab strip separator is always 1 pixel high -
- // add a clip rect to avoid drawing the tab edge over it.
- NSRect clipRect = bounds;
- clipRect.origin.y += [self cr_lineWidth];
- NSRectClip(clipRect);
- // In MD, the tab stroke is always opaque.
- alpha = 1;
- }
+ // In Material Design the tab strip separator is always 1 pixel high -
+ // add a clip rect to avoid drawing the tab edge over it.
+ NSRect clipRect = bounds;
+ clipRect.origin.y += [self cr_lineWidth];
+ NSRectClip(clipRect);
const ui::ThemeProvider* provider = [[self window] themeProvider];
GetStrokeImage(state_ == NSOnState,
provider && provider->ShouldIncreaseContrast()
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_view.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698