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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_view.mm

Issue 19918002: Refactor [FramedBrowserWindow drawWindowThemeInDirtyRect:] to use themeImagePositionForAlignment: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/sdk_forward_declarations.h" 8 #include "base/mac/sdk_forward_declarations.h"
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #import "chrome/browser/ui/cocoa/nsview_additions.h" 10 #import "chrome/browser/ui/cocoa/nsview_additions.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 317
318 // Draws the tab background. 318 // Draws the tab background.
319 - (void)drawFill:(NSRect)dirtyRect { 319 - (void)drawFill:(NSRect)dirtyRect {
320 gfx::ScopedNSGraphicsContextSaveGState scopedGState; 320 gfx::ScopedNSGraphicsContextSaveGState scopedGState;
321 NSGraphicsContext* context = [NSGraphicsContext currentContext]; 321 NSGraphicsContext* context = [NSGraphicsContext currentContext];
322 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]); 322 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]);
323 323
324 ThemeService* themeProvider = 324 ThemeService* themeProvider =
325 static_cast<ThemeService*>([[self window] themeProvider]); 325 static_cast<ThemeService*>([[self window] themeProvider]);
326 NSPoint phase = [[self window] 326 NSPoint position = [[self window]
327 themePatternPhaseForAlignment: THEME_PATTERN_ALIGN_WITH_TAB_STRIP]; 327 themeImagePositionForAlignment: THEME_IMAGE_ALIGN_WITH_TAB_STRIP];
328 [context cr_setPatternPhase:phase forView:self]; 328 [context cr_setPatternPhase:position forView:self];
329 329
330 CGImageRef mask([self tabClippingMask]); 330 CGImageRef mask([self tabClippingMask]);
331 CGRect maskBounds = CGRectMake(0, 0, maskCacheWidth_, kMaskHeight); 331 CGRect maskBounds = CGRectMake(0, 0, maskCacheWidth_, kMaskHeight);
332 CGContextClipToMask(cgContext, maskBounds, mask); 332 CGContextClipToMask(cgContext, maskBounds, mask);
333 333
334 bool selected = [self state]; 334 bool selected = [self state];
335 if (selected) { 335 if (selected) {
336 [self drawFillForActiveTab:dirtyRect]; 336 [self drawFillForActiveTab:dirtyRect];
337 return; 337 return;
338 } 338 }
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 CGFloat middleWidth = tabWidth - leftWidth - rightWidth; 705 CGFloat middleWidth = tabWidth - leftWidth - rightWidth;
706 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight); 706 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight);
707 [[NSColor whiteColor] setFill]; 707 [[NSColor whiteColor] setFill];
708 NSRectFill(middleRect); 708 NSRectFill(middleRect);
709 709
710 maskCache_.reset(CGBitmapContextCreateImage(maskContext)); 710 maskCache_.reset(CGBitmapContextCreateImage(maskContext));
711 return maskCache_; 711 return maskCache_;
712 } 712 }
713 713
714 @end // @implementation TabView(Private) 714 @end // @implementation TabView(Private)
OLDNEW
« 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