OLD | NEW |
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 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
12 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h" | 12 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
| 15 @class AutofillTooltipController; |
15 @class HyperlinkTextView; | 16 @class HyperlinkTextView; |
| 17 |
16 namespace autofill { | 18 namespace autofill { |
17 class AutofillDialogViewDelegate; | 19 class AutofillDialogViewDelegate; |
18 } | 20 } |
19 | 21 |
20 // Contains a single notification for requestAutocomplete dialog. | 22 // Contains a single notification for requestAutocomplete dialog. |
21 @interface AutofillNotificationController : | 23 @interface AutofillNotificationController : |
22 NSViewController<AutofillLayout, NSTextViewDelegate> { | 24 NSViewController<AutofillLayout, NSTextViewDelegate> { |
23 @private | 25 @private |
24 // Text view for label. | 26 // Text view for label. |
25 base::scoped_nsobject<HyperlinkTextView> textview_; | 27 base::scoped_nsobject<HyperlinkTextView> textview_; |
26 | 28 |
27 // Optional checkbox. | 29 // Optional checkbox. |
28 base::scoped_nsobject<NSButton> checkbox_; | 30 base::scoped_nsobject<NSButton> checkbox_; |
29 | 31 |
30 // Optional tooltip icon. | 32 // Optional tooltip icon. |
31 base::scoped_nsobject<NSImageView> tooltipIcon_; | 33 base::scoped_nsobject<AutofillTooltipController> tooltipController_; |
32 | 34 |
33 // Optional link target. | 35 // Optional link target. |
34 GURL linkURL_; | 36 GURL linkURL_; |
35 | 37 |
36 // Notification type. | 38 // Notification type. |
37 autofill::DialogNotification::Type notificationType_; | 39 autofill::DialogNotification::Type notificationType_; |
38 | 40 |
39 // Main delegate for the dialog. Weak, owns dialog. | 41 // Main delegate for the dialog. Weak, owns dialog. |
40 autofill::AutofillDialogViewDelegate* delegate_; | 42 autofill::AutofillDialogViewDelegate* delegate_; |
41 } | 43 } |
42 | 44 |
43 @property(nonatomic, readonly) NSTextView* textview; | 45 @property(nonatomic, readonly) NSTextView* textview; |
44 @property(nonatomic, readonly) NSButton* checkbox; | 46 @property(nonatomic, readonly) NSButton* checkbox; |
45 @property(nonatomic, readonly) NSImageView* tooltipIcon; | 47 @property(nonatomic, readonly) NSView* tooltipView; |
46 | 48 |
47 // Designated initializer. Initializes the controller as specified by | 49 // Designated initializer. Initializes the controller as specified by |
48 // |notification|. | 50 // |notification|. |
49 - (id)initWithNotification:(const autofill::DialogNotification*)notification | 51 - (id)initWithNotification:(const autofill::DialogNotification*)notification |
50 delegate:(autofill::AutofillDialogViewDelegate*)delegate; | 52 delegate:(autofill::AutofillDialogViewDelegate*)delegate; |
51 | 53 |
52 // Displays arrow on top of notification if set to YES. |anchorView| determines | 54 // Displays arrow on top of notification if set to YES. |anchorView| determines |
53 // the arrow position - the tip of the arrow is centered on the horizontal | 55 // the arrow position - the tip of the arrow is centered on the horizontal |
54 // midpoint of the anchorView. | 56 // midpoint of the anchorView. |
55 - (void)setHasArrow:(BOOL)hasArrow withAnchorView:(NSView*)anchorView; | 57 - (void)setHasArrow:(BOOL)hasArrow withAnchorView:(NSView*)anchorView; |
56 | 58 |
57 // Indicates if the controller draws an arrow. | 59 // Indicates if the controller draws an arrow. |
58 - (BOOL)hasArrow; | 60 - (BOOL)hasArrow; |
59 | 61 |
60 // Compute preferred size for given width. | 62 // Compute preferred size for given width. |
61 - (NSSize)preferredSizeForWidth:(CGFloat)width; | 63 - (NSSize)preferredSizeForWidth:(CGFloat)width; |
62 | 64 |
63 - (IBAction)checkboxClicked:(id)sender; | 65 - (IBAction)checkboxClicked:(id)sender; |
64 | 66 |
65 @end | 67 @end |
66 | 68 |
67 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_ | 69 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_ |
OLD | NEW |