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

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

Issue 1204473003: Fixed the copy link issue in the sad tab view (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « AUTHORS ('k') | 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_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/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "grit/theme_resources.h" 11 #include "grit/theme_resources.h"
12 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" 12 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
13 #import "ui/base/cocoa/controls/blue_label_button.h" 13 #import "ui/base/cocoa/controls/blue_label_button.h"
14 #import "ui/base/cocoa/controls/hyperlink_text_view.h" 14 #import "ui/base/cocoa/controls/hyperlink_text_view.h"
15 #import "ui/base/cocoa/nscolor_additions.h" 15 #import "ui/base/cocoa/nscolor_additions.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/l10n/l10n_util_mac.h" 17 #include "ui/base/l10n/l10n_util_mac.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
20 #include "url/gurl.h"
20 21
21 // Maximum width used by page contents. 22 // Maximum width used by page contents.
22 static const CGFloat kMaxContainerWidth = 600; 23 static const CGFloat kMaxContainerWidth = 600;
23 // Padding between icon and title. 24 // Padding between icon and title.
24 static const CGFloat kIconTitleSpacing = 40; 25 static const CGFloat kIconTitleSpacing = 40;
25 // Padding between title and message. 26 // Padding between title and message.
26 static const CGFloat kTitleMessageSpacing = 18; 27 static const CGFloat kTitleMessageSpacing = 18;
27 // Padding between message and link. 28 // Padding between message and link.
28 static const CGFloat kMessageLinkSpacing = 21; 29 static const CGFloat kMessageLinkSpacing = 21;
29 // Padding between link and button. 30 // Padding between link and button.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Get the help text and link. 175 // Get the help text and link.
175 size_t linkOffset = 0; 176 size_t linkOffset = 0;
176 const base::string16 helpLink = 177 const base::string16 helpLink =
177 l10n_util::GetStringUTF16(IDS_SAD_TAB_HELP_LINK); 178 l10n_util::GetStringUTF16(IDS_SAD_TAB_HELP_LINK);
178 NSString* helpMessage(base::SysUTF16ToNSString(l10n_util::GetStringFUTF16( 179 NSString* helpMessage(base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(
179 IDS_SAD_TAB_HELP_MESSAGE, helpLink, &linkOffset))); 180 IDS_SAD_TAB_HELP_MESSAGE, helpLink, &linkOffset)));
180 [help_ setMessage:helpMessage 181 [help_ setMessage:helpMessage
181 withFont:helpFont 182 withFont:helpFont
182 messageColor:[message_ textColor]]; 183 messageColor:[message_ textColor]];
183 [help_ addLinkRange:NSMakeRange(linkOffset, helpLink.length()) 184 [help_ addLinkRange:NSMakeRange(linkOffset, helpLink.length())
184 withName:@"" 185 withName:[NSString stringWithUTF8String:chrome::kCrashReasonURL]
185 linkColor:[message_ textColor]]; 186 linkColor:[message_ textColor]];
186 [help_ setAlignment:NSLeftTextAlignment]; 187 [help_ setAlignment:NSLeftTextAlignment];
187 [help_ sizeToFit]; 188 [help_ sizeToFit];
188 } 189 }
189 190
190 // Called when someone clicks on the embedded link. 191 // Called when someone clicks on the embedded link.
191 - (BOOL)textView:(NSTextView*)textView 192 - (BOOL)textView:(NSTextView*)textView
192 clickedOnLink:(id)link 193 clickedOnLink:(id)link
193 atIndex:(NSUInteger)charIndex { 194 atIndex:(NSUInteger)charIndex {
194 [NSApp sendAction:@selector(openLearnMoreAboutCrashLink:) to:nil from:self]; 195 [NSApp sendAction:@selector(openLearnMoreAboutCrashLink:) to:nil from:self];
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 floor((NSWidth(bounds) - frameSize.width) / 2), 241 floor((NSWidth(bounds) - frameSize.width) / 2),
241 std::min(kMaxTopMargin, std::max(kTabMargin, 242 std::min(kMaxTopMargin, std::max(kTabMargin,
242 NSHeight(bounds) - [container_ contentHeight] - kTabMargin)))]; 243 NSHeight(bounds) - [container_ contentHeight] - kTabMargin)))];
243 } 244 }
244 245
245 - (NSButton*)reloadButton { 246 - (NSButton*)reloadButton {
246 return [container_ reloadButton]; 247 return [container_ reloadButton];
247 } 248 }
248 249
249 @end 250 @end
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698