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

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

Issue 887823002: Finished swap out of old API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unit test for [HyperlinkTextView setMessageAndLink:withLink:atOffset:font:messageColor:linkC… Created 5 years, 10 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
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_cocoa.h" 5 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_view_cocoa.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 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" 9 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 176
177 // Get the help text and link. 177 // Get the help text and link.
178 size_t linkOffset = 0; 178 size_t linkOffset = 0;
179 const base::string16 helpLink =
180 l10n_util::GetStringUTF16(IDS_SAD_TAB_HELP_LINK);
179 NSString* helpMessage(base::SysUTF16ToNSString(l10n_util::GetStringFUTF16( 181 NSString* helpMessage(base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(
180 IDS_SAD_TAB_HELP_MESSAGE, base::string16(), &linkOffset))); 182 IDS_SAD_TAB_HELP_MESSAGE, helpLink, &linkOffset)));
181 NSString* helpLink = l10n_util::GetNSString(IDS_SAD_TAB_HELP_LINK);
182 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; 183 NSFont* font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
183 [help_ setMessageAndLink:helpMessage 184 [help_ setMessage:helpMessage
184 withLink:helpLink 185 withFont:font
185 atOffset:linkOffset 186 messageColor:[NSColor whiteColor]];
186 font:font 187 [help_ addLinkRange:NSMakeRange(linkOffset, helpLink.length())
187 messageColor:[NSColor whiteColor] 188 withName:@""
188 linkColor:[NSColor whiteColor]]; 189 linkColor:[NSColor whiteColor]];
189 [help_ setAlignment:NSCenterTextAlignment]; 190 [help_ setAlignment:NSCenterTextAlignment];
190 } 191 }
191 192
192 // Called when someone clicks on the embedded link. 193 // Called when someone clicks on the embedded link.
193 - (BOOL)textView:(NSTextView*)textView 194 - (BOOL)textView:(NSTextView*)textView
194 clickedOnLink:(id)link 195 clickedOnLink:(id)link
195 atIndex:(NSUInteger)charIndex { 196 atIndex:(NSUInteger)charIndex {
196 if (controller_) 197 if (controller_)
197 [controller_ openLearnMoreAboutCrashLink:nil]; 198 [controller_ openLearnMoreAboutCrashLink:nil];
198 return YES; 199 return YES;
199 } 200 }
200 201
201 @end 202 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698