OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/new_tab_button.h" | 5 #import "chrome/browser/ui/cocoa/new_tab_button.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 9 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
10 #include "chrome/browser/ui/cocoa/tabs/tab_view.h" | 10 #include "chrome/browser/ui/cocoa/tabs/tab_view.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 fillColor = | 352 fillColor = |
353 theme->GetNSImageColorNamed(IDR_THEME_TAB_BACKGROUND_INACTIVE); | 353 theme->GetNSImageColorNamed(IDR_THEME_TAB_BACKGROUND_INACTIVE); |
354 break; | 354 break; |
355 | 355 |
356 default: | 356 default: |
357 fillColor = [NSColor redColor]; | 357 fillColor = [NSColor redColor]; |
358 // All states should be accounted for above. | 358 // All states should be accounted for above. |
359 NOTREACHED(); | 359 NOTREACHED(); |
360 } | 360 } |
361 | 361 |
362 base::scoped_nsobject<NewTabButtonCustomImageRep> imageRep = | 362 base::scoped_nsobject<NewTabButtonCustomImageRep> imageRep( |
363 [[NewTabButtonCustomImageRep alloc] | 363 [[NewTabButtonCustomImageRep alloc] |
364 initWithDrawSelector:@selector(drawNewTabButtonImage:) | 364 initWithDrawSelector:@selector(drawNewTabButtonImage:) |
365 delegate:[NewTabButton class]]; | 365 delegate:[NewTabButton class]]); |
366 [imageRep setDestView:self]; | 366 [imageRep setDestView:self]; |
367 [imageRep setFillColor:fillColor]; | 367 [imageRep setFillColor:fillColor]; |
368 [imageRep setPatternPhasePosition: | 368 [imageRep setPatternPhasePosition: |
369 [[self window] | 369 [[self window] |
370 themeImagePositionForAlignment:THEME_IMAGE_ALIGN_WITH_TAB_STRIP]]; | 370 themeImagePositionForAlignment:THEME_IMAGE_ALIGN_WITH_TAB_STRIP]]; |
371 [imageRep setOverlayOption:overlayOption]; | 371 [imageRep setOverlayOption:overlayOption]; |
372 | 372 |
373 NSImage* newTabButtonImage = | 373 NSImage* newTabButtonImage = |
374 [[[NSImage alloc] initWithSize:newTabButtonImageSize] autorelease]; | 374 [[[NSImage alloc] initWithSize:newTabButtonImageSize] autorelease]; |
375 [newTabButtonImage setCacheMode:NSImageCacheAlways]; | 375 [newTabButtonImage setCacheMode:NSImageCacheAlways]; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 [fillColor set]; | 530 [fillColor set]; |
531 CGContextRef context = static_cast<CGContextRef>( | 531 CGContextRef context = static_cast<CGContextRef>( |
532 [[NSGraphicsContext currentContext] graphicsPort]); | 532 [[NSGraphicsContext currentContext] graphicsPort]); |
533 CGFloat lineWidth = LineWidthFromContext(context); | 533 CGFloat lineWidth = LineWidthFromContext(context); |
534 [[NewTabButton newTabButtonBezierPathWithLineWidth:lineWidth] fill]; | 534 [[NewTabButton newTabButtonBezierPathWithLineWidth:lineWidth] fill]; |
535 [image unlockFocus]; | 535 [image unlockFocus]; |
536 return image; | 536 return image; |
537 } | 537 } |
538 | 538 |
539 @end | 539 @end |
OLD | NEW |