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 AutofillTooltipController
;
16 @
class HyperlinkTextView
;
19 class AutofillDialogViewDelegate
;
22 // Contains a single notification for requestAutocomplete dialog.
23 @interface AutofillNotificationController
:
24 NSViewController
<AutofillLayout
, NSTextViewDelegate
> {
26 // Text view for label.
27 base::scoped_nsobject
<HyperlinkTextView
> textview_
;
30 base::scoped_nsobject
<NSButton
> checkbox_
;
32 // Optional tooltip icon.
33 base::scoped_nsobject
<AutofillTooltipController
> tooltipController_
;
35 // Optional link target.
39 autofill::DialogNotification::Type notificationType_
;
41 // Main delegate for the dialog. Weak, owns dialog.
42 autofill::AutofillDialogViewDelegate
* delegate_
;
45 @
property(nonatomic
, readonly
) NSTextView
* textview
;
46 @
property(nonatomic
, readonly
) NSButton
* checkbox
;
47 @
property(nonatomic
, readonly
) NSView
* tooltipView
;
49 // Designated initializer. Initializes the controller as specified by
51 - (id
)initWithNotification
:(const autofill::DialogNotification
*)notification
52 delegate
:(autofill::AutofillDialogViewDelegate
*)delegate
;
54 // Displays arrow on top of notification if set to YES. |anchorView| determines
55 // the arrow position - the tip of the arrow is centered on the horizontal
56 // midpoint of the anchorView.
57 - (void)setHasArrow
:(BOOL
)hasArrow withAnchorView
:(NSView
*)anchorView
;
59 // Indicates if the controller draws an arrow.
62 // Compute preferred size for given width.
63 - (NSSize
)preferredSizeForWidth
:(CGFloat
)width
;
65 - (IBAction
)checkboxClicked
:(id
)sender
;
69 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_