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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/sad_tab_view.mm

Issue 328303007: [Mac] Yosemite: Center the sad tab help text (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h" 5 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" 9 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
10 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" 10 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 - (void)initializeHelpText { 167 - (void)initializeHelpText {
168 // Programmatically create the help link. Note that the frame's initial 168 // Programmatically create the help link. Note that the frame's initial
169 // height must be set for the programmatic resizing to work. 169 // height must be set for the programmatic resizing to work.
170 help_.reset( 170 help_.reset(
171 [[HyperlinkTextView alloc] initWithFrame:NSMakeRect(0, 0, 1, 17)]); 171 [[HyperlinkTextView alloc] initWithFrame:NSMakeRect(0, 0, 1, 17)]);
172 [help_ setAutoresizingMask: 172 [help_ setAutoresizingMask:
173 NSViewMinXMargin|NSViewWidthSizable|NSViewMaxXMargin|NSViewMinYMargin]; 173 NSViewMinXMargin|NSViewWidthSizable|NSViewMaxXMargin|NSViewMinYMargin];
174 [self addSubview:help_]; 174 [self addSubview:help_];
175 [help_ setDelegate:self]; 175 [help_ setDelegate:self];
176 [help_ setAlignment:NSCenterTextAlignment];
177 176
178 // Get the help text and link. 177 // Get the help text and link.
179 size_t linkOffset = 0; 178 size_t linkOffset = 0;
180 NSString* helpMessage(base::SysUTF16ToNSString(l10n_util::GetStringFUTF16( 179 NSString* helpMessage(base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(
181 IDS_SAD_TAB_HELP_MESSAGE, base::string16(), &linkOffset))); 180 IDS_SAD_TAB_HELP_MESSAGE, base::string16(), &linkOffset)));
182 NSString* helpLink = l10n_util::GetNSString(IDS_SAD_TAB_HELP_LINK); 181 NSString* helpLink = l10n_util::GetNSString(IDS_SAD_TAB_HELP_LINK);
183 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; 182 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
184 [help_ setMessageAndLink:helpMessage 183 [help_ setMessageAndLink:helpMessage
185 withLink:helpLink 184 withLink:helpLink
186 atOffset:linkOffset 185 atOffset:linkOffset
187 font:font 186 font:font
188 messageColor:[NSColor whiteColor] 187 messageColor:[NSColor whiteColor]
189 linkColor:[NSColor whiteColor]]; 188 linkColor:[NSColor whiteColor]];
189 [help_ setAlignment:NSCenterTextAlignment];
190 } 190 }
191 191
192 // Called when someone clicks on the embedded link. 192 // Called when someone clicks on the embedded link.
193 - (BOOL)textView:(NSTextView*)textView 193 - (BOOL)textView:(NSTextView*)textView
194 clickedOnLink:(id)link 194 clickedOnLink:(id)link
195 atIndex:(NSUInteger)charIndex { 195 atIndex:(NSUInteger)charIndex {
196 if (controller_) 196 if (controller_)
197 [controller_ openLearnMoreAboutCrashLink:nil]; 197 [controller_ openLearnMoreAboutCrashLink:nil];
198 return YES; 198 return YES;
199 } 199 }
200 200
201 @end 201 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698