| 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 "base/sys_string_conversions.h" |
| 8 #include "chrome/common/l10n_util.h" |
| 9 #include "grit/generated_resources.h" |
| 10 |
| 7 static const int kSadTabOffset = -64; | 11 static const int kSadTabOffset = -64; |
| 8 static const int kIconTitleSpacing = 20; | 12 static const int kIconTitleSpacing = 20; |
| 9 static const int kTitleMessageSpacing = 15; | 13 static const int kTitleMessageSpacing = 15; |
| 10 | 14 |
| 11 @implementation SadTabView | 15 @implementation SadTabView |
| 12 | 16 |
| 13 - (void)drawRect:(NSRect)dirtyRect { | 17 - (void)drawRect:(NSRect)dirtyRect { |
| 14 NSImage* sadTabImage = [NSImage imageNamed:@"sadtab"]; | 18 NSImage* sadTabImage = [NSImage imageNamed:@"sadtab"]; |
| 15 NSString* title = @"Aw, Snap!"; // TODO(avi):localize | 19 NSString* title = |
| 16 NSString* message = @"Something went wrong while displaying this webpage. " | 20 base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_TITLE)); |
| 17 "To continue, press Reload or go to another page."; | 21 NSString* message = |
| 22 base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_MESSAGE)); |
| 18 | 23 |
| 19 NSColor* textColor = [NSColor whiteColor]; | 24 NSColor* textColor = [NSColor whiteColor]; |
| 20 NSColor* backgroundColor = [NSColor colorWithCalibratedRed:(35.0f/255.0f) | 25 NSColor* backgroundColor = [NSColor colorWithCalibratedRed:(35.0f/255.0f) |
| 21 green:(48.0f/255.0f) | 26 green:(48.0f/255.0f) |
| 22 blue:(64.0f/255.0f) | 27 blue:(64.0f/255.0f) |
| 23 alpha:1.0]; | 28 alpha:1.0]; |
| 24 | 29 |
| 25 // Layout | 30 // Layout |
| 26 NSFont* titleFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]; | 31 NSFont* titleFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]; |
| 27 NSFont* messageFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; | 32 NSFont* messageFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 70 |
| 66 [sadTabImage drawAtPoint:NSMakePoint(iconX, iconY) | 71 [sadTabImage drawAtPoint:NSMakePoint(iconX, iconY) |
| 67 fromRect:NSZeroRect | 72 fromRect:NSZeroRect |
| 68 operation:NSCompositeSourceOver | 73 operation:NSCompositeSourceOver |
| 69 fraction:1.0f]; | 74 fraction:1.0f]; |
| 70 [titleString drawAtPoint:NSMakePoint(titleX, titleY)]; | 75 [titleString drawAtPoint:NSMakePoint(titleX, titleY)]; |
| 71 [messageString drawAtPoint:NSMakePoint(messageX, messageY)]; | 76 [messageString drawAtPoint:NSMakePoint(messageX, messageY)]; |
| 72 } | 77 } |
| 73 | 78 |
| 74 @end | 79 @end |
| OLD | NEW |