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

Side by Side Diff: chrome/browser/ui/cocoa/profile_signin_confirmation_view_controller.mm

Issue 63153003: mac: Prepare for -Wunused-functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "chrome/browser/ui/cocoa/profile_signin_confirmation_view_controller.h" 5 #import "chrome/browser/ui/cocoa/profile_signin_confirmation_view_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 16 matching lines...) Expand all
27 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" 27 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
28 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" 28 #import "ui/base/cocoa/controls/hyperlink_button_cell.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 30
31 namespace { 31 namespace {
32 32
33 const CGFloat kWindowMinWidth = 500; 33 const CGFloat kWindowMinWidth = 500;
34 const CGFloat kButtonGap = 6; 34 const CGFloat kButtonGap = 6;
35 const CGFloat kDialogAlertBarBorderWidth = 1; 35 const CGFloat kDialogAlertBarBorderWidth = 1;
36 36
37 // Shift the origin of |view|'s frame by the given amount in the
38 // positive y direction (up).
39 void ShiftOriginY(NSView* view, CGFloat amount) {
40 NSPoint origin = [view frame].origin;
41 origin.y += amount;
42 [view setFrameOrigin:origin];
43 }
44
45 // Determine the frame required to fit the content of a string. Uses the 37 // Determine the frame required to fit the content of a string. Uses the
46 // provided height and width as preferred dimensions, where a value of 38 // provided height and width as preferred dimensions, where a value of
47 // 0.0 indicates no preference. 39 // 0.0 indicates no preference.
48 NSRect ComputeFrame(NSAttributedString* text, CGFloat width, CGFloat height) { 40 NSRect ComputeFrame(NSAttributedString* text, CGFloat width, CGFloat height) {
49 NSRect frame = 41 NSRect frame =
50 [text boundingRectWithSize:NSMakeSize(width, height) 42 [text boundingRectWithSize:NSMakeSize(width, height)
51 options:NSStringDrawingUsesLineFragmentOrigin]; 43 options:NSStringDrawingUsesLineFragmentOrigin];
52 // boundingRectWithSize is known to underestimate the width. 44 // boundingRectWithSize is known to underestimate the width.
53 static const CGFloat kTextViewPadding = 10; 45 static const CGFloat kTextViewPadding = 10;
54 frame.size.width += kTextViewPadding; 46 frame.size.width += kTextViewPadding;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 [textField setAttributedStringValue: 113 [textField setAttributedStringValue:
122 constrained_window::GetAttributedLabelString( 114 constrained_window::GetAttributedLabelString(
123 SysUTF16ToNSString(message), 115 SysUTF16ToNSString(message),
124 font_style, 116 font_style,
125 NSNaturalTextAlignment, 117 NSNaturalTextAlignment,
126 NSLineBreakByWordWrapping)]; 118 NSLineBreakByWordWrapping)];
127 [parent addSubview:textField]; 119 [parent addSubview:textField];
128 return textField; 120 return textField;
129 } 121 }
130 122
131 // Create a new link button and add it to the specified parent.
132 NSButton* AddLinkButton(
133 NSView* parent,
134 const string16& message,
135 id target,
136 SEL selector) {
137 NSButton* button =
138 [HyperlinkButtonCell buttonWithString:SysUTF16ToNSString(message)];
139 [button setTarget:target];
140 [button setAction:selector];
141 HyperlinkButtonCell* cell = [button cell];
142 cell.textColor =
143 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
144 cell.shouldUnderline = NO;
145 [parent addSubview:button];
146 return button;
147 }
148
149 } // namespace 123 } // namespace
150 124
151 @interface ProfileSigninConfirmationViewController () 125 @interface ProfileSigninConfirmationViewController ()
152 - (void)learnMore; 126 - (void)learnMore;
153 - (void)addButton:(NSButton*)button 127 - (void)addButton:(NSButton*)button
154 withTitle:(int)resourceID 128 withTitle:(int)resourceID
155 target:(id)target 129 target:(id)target
156 action:(SEL)action 130 action:(SEL)action
157 shouldAutoSize:(BOOL)shouldAutoSize; 131 shouldAutoSize:(BOOL)shouldAutoSize;
158 @end 132 @end
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 436
463 - (NSButton*)createProfileButton { 437 - (NSButton*)createProfileButton {
464 return createProfileButton_.get(); 438 return createProfileButton_.get();
465 } 439 }
466 440
467 - (NSTextView*)explanationField { 441 - (NSTextView*)explanationField {
468 return explanationField_.get(); 442 return explanationField_.get();
469 } 443 }
470 444
471 @end 445 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | chrome/browser/ui/webui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698