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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
12 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h"
15 @class HyperlinkTextView;
17 class AutofillDialogViewDelegate;
20 // Contains a single notification for requestAutocomplete dialog.
21 @interface AutofillNotificationController :
22 NSViewController<AutofillLayout, NSTextViewDelegate> {
24 // Text view for label.
25 base::scoped_nsobject<HyperlinkTextView> textview_;
28 base::scoped_nsobject<NSButton> checkbox_;
30 // Optional tooltip icon.
31 base::scoped_nsobject<NSImageView> tooltipIcon_;
33 // Optional link target.
37 autofill::DialogNotification::Type notificationType_;
39 // Main delegate for the dialog. Weak, owns dialog.
40 autofill::AutofillDialogViewDelegate* delegate_;
43 @property(nonatomic, readonly) NSTextView* textview;
44 @property(nonatomic, readonly) NSButton* checkbox;
45 @property(nonatomic, readonly) NSImageView* tooltipIcon;
47 // Designated initializer. Initializes the controller as specified by
49 - (id)initWithNotification:(const autofill::DialogNotification*)notification
50 delegate:(autofill::AutofillDialogViewDelegate*)delegate;
52 // 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
54 // midpoint of the anchorView.
55 - (void)setHasArrow:(BOOL)hasArrow withAnchorView:(NSView*)anchorView;
57 // Indicates if the controller draws an arrow.
60 // Compute preferred size for given width.
61 - (NSSize)preferredSizeForWidth:(CGFloat)width;
63 - (IBAction)checkboxClicked:(id)sender;
67 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_