| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/cocoa/sad_tab_view.h" | 5 #include "chrome/browser/cocoa/sad_tab_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "app/resource_bundle.h" |
| 8 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/cocoa/nsimage_cache.h" | |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| 11 #include "grit/theme_resources.h" |
| 11 | 12 |
| 12 static const int kSadTabOffset = -64; | 13 static const int kSadTabOffset = -64; |
| 13 static const int kIconTitleSpacing = 20; | 14 static const int kIconTitleSpacing = 20; |
| 14 static const int kTitleMessageSpacing = 15; | 15 static const int kTitleMessageSpacing = 15; |
| 15 | 16 |
| 16 @implementation SadTabView | 17 @implementation SadTabView |
| 17 | 18 |
| 18 - (void)drawRect:(NSRect)dirtyRect { | 19 - (void)drawRect:(NSRect)dirtyRect { |
| 19 NSImage* sadTabImage = nsimage_cache::ImageNamed(@"sadtab.png"); | 20 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 20 NSString* title = | 21 NSImage* sadTabImage = rb.GetNSImageNamed(IDR_SAD_TAB); |
| 21 base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_TITLE)); | 22 DCHECK(sadTabImage); |
| 22 NSString* message = | 23 NSString* title = l10n_util::GetNSStringWithFixup(IDS_SAD_TAB_TITLE); |
| 23 base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_MESSAGE)); | 24 NSString* message = l10n_util::GetNSStringWithFixup(IDS_SAD_TAB_MESSAGE); |
| 24 | 25 |
| 25 NSColor* textColor = [NSColor whiteColor]; | 26 NSColor* textColor = [NSColor whiteColor]; |
| 26 NSColor* backgroundColor = [NSColor colorWithCalibratedRed:(35.0f/255.0f) | 27 NSColor* backgroundColor = [NSColor colorWithCalibratedRed:(35.0f/255.0f) |
| 27 green:(48.0f/255.0f) | 28 green:(48.0f/255.0f) |
| 28 blue:(64.0f/255.0f) | 29 blue:(64.0f/255.0f) |
| 29 alpha:1.0]; | 30 alpha:1.0]; |
| 30 | 31 |
| 31 // Layout | 32 // Layout |
| 32 NSFont* titleFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]; | 33 NSFont* titleFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]; |
| 33 NSFont* messageFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; | 34 NSFont* messageFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 72 |
| 72 [sadTabImage drawAtPoint:NSMakePoint(iconX, iconY) | 73 [sadTabImage drawAtPoint:NSMakePoint(iconX, iconY) |
| 73 fromRect:NSZeroRect | 74 fromRect:NSZeroRect |
| 74 operation:NSCompositeSourceOver | 75 operation:NSCompositeSourceOver |
| 75 fraction:1.0f]; | 76 fraction:1.0f]; |
| 76 [titleString drawAtPoint:NSMakePoint(titleX, titleY)]; | 77 [titleString drawAtPoint:NSMakePoint(titleX, titleY)]; |
| 77 [messageString drawAtPoint:NSMakePoint(messageX, messageY)]; | 78 [messageString drawAtPoint:NSMakePoint(messageX, messageY)]; |
| 78 } | 79 } |
| 79 | 80 |
| 80 @end | 81 @end |
| OLD | NEW |