OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_UTILS_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_UTILS_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_UTILS_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
11 | 11 |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "ui/gfx/range/range.h" |
13 | 14 |
14 namespace autofill { | 15 @class HyperlinkTextView; |
15 struct PasswordForm; | |
16 } // autofill | |
17 | 16 |
18 const CGFloat kDesiredBubbleWidth = 370; | 17 const CGFloat kDesiredBubbleWidth = 370; |
19 const CGFloat kFramePadding = 16; | 18 const CGFloat kFramePadding = 16; |
20 const CGFloat kItemLabelSpacing = 10; | 19 const CGFloat kItemLabelSpacing = 10; |
21 const CGFloat kRelatedControlHorizontalPadding = 2; | 20 const CGFloat kRelatedControlHorizontalPadding = 2; |
22 const CGFloat kRelatedControlVerticalSpacing = 8; | 21 const CGFloat kRelatedControlVerticalSpacing = 8; |
23 const CGFloat kUnrelatedControlVerticalPadding = 15; | 22 const CGFloat kUnrelatedControlVerticalPadding = 15; |
24 const CGFloat kDesiredRowWidth = kDesiredBubbleWidth - 2 * kFramePadding; | 23 const CGFloat kDesiredRowWidth = kDesiredBubbleWidth - 2 * kFramePadding; |
25 const CGFloat kTitleTextInset = 2; | 24 const CGFloat kTitleTextInset = 2; |
26 | 25 |
27 // Returns a font for password bubbles. | 26 // Returns a font for password bubbles. |
28 NSFont* LabelFont(); | 27 NSFont* LabelFont(); |
29 | 28 |
30 // Returns a size of a text that is defined by |resourceID| with a font | 29 // Returns a size of a text that is defined by |resourceID| with a font |
31 // returned by LabelFont(). | 30 // returned by LabelFont(). |
32 NSSize LabelSize(int resourceID); | 31 NSSize LabelSize(int resourceID); |
33 | 32 |
34 // Initialize |textField| with |text| and default style parameters. | 33 // Initialize |textField| with |text| and default style parameters. |
35 void InitLabel(NSTextField* textField, const base::string16& text); | 34 void InitLabel(NSTextField* textField, const base::string16& text); |
36 | 35 |
37 // Returns widths of 2 columns, that are proportional to |columnsWidth| and | 36 // Returns widths of 2 columns, that are proportional to |columnsWidth| and |
38 // their total width is equal to |maxWidth|. | 37 // their total width is equal to |maxWidth|. |
39 std::pair<CGFloat, CGFloat> GetResizedColumns( | 38 std::pair<CGFloat, CGFloat> GetResizedColumns( |
40 CGFloat maxWidth, | 39 CGFloat maxWidth, |
41 std::pair<CGFloat, CGFloat> columnsWidth); | 40 std::pair<CGFloat, CGFloat> columnsWidth); |
42 | 41 |
43 // Returns a password text field initialized with |text|. | 42 // Returns a password text field initialized with |text|. |
44 NSSecureTextField* PasswordLabel(const base::string16& text); | 43 NSSecureTextField* PasswordLabel(const base::string16& text); |
45 | 44 |
| 45 // Returns a button of the standard style for the bubble. |
| 46 NSButton* DialogButton(NSString* title); |
| 47 |
| 48 // Returns the title label with |text|. Nonempty |range| may specify a link |
| 49 // range. |
| 50 HyperlinkTextView* TitleLabelWithLink(const base::string16& text, |
| 51 gfx::Range range, |
| 52 id<NSTextViewDelegate> delegate); |
| 53 |
46 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_UTILS_H_ | 54 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORDS_BUBBLE_UTILS_H_ |
OLD | NEW |