- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / autofill / autofill_notification_controller.h
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.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_
7
8 #import <Cocoa/Cocoa.h>
9
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"
13 #include "url/gurl.h"
14
15 @class HyperlinkTextView;
16 namespace autofill {
17 class AutofillDialogViewDelegate;
18 }
19
20 // Contains a single notification for requestAutocomplete dialog.
21 @interface AutofillNotificationController :
22     NSViewController<AutofillLayout, NSTextViewDelegate> {
23  @private
24   // Text view for label.
25   base::scoped_nsobject<HyperlinkTextView> textview_;
26
27   // Optional checkbox.
28   base::scoped_nsobject<NSButton> checkbox_;
29
30   // Optional tooltip icon.
31   base::scoped_nsobject<NSImageView> tooltipIcon_;
32
33   // Optional link target.
34   GURL linkURL_;
35
36   // Notification type.
37   autofill::DialogNotification::Type notificationType_;
38
39   // Main delegate for the dialog. Weak, owns dialog.
40   autofill::AutofillDialogViewDelegate* delegate_;
41 }
42
43 @property(nonatomic, readonly) NSTextView* textview;
44 @property(nonatomic, readonly) NSButton* checkbox;
45 @property(nonatomic, readonly) NSImageView* tooltipIcon;
46
47 // Designated initializer. Initializes the controller as specified by
48 // |notification|.
49 - (id)initWithNotification:(const autofill::DialogNotification*)notification
50                   delegate:(autofill::AutofillDialogViewDelegate*)delegate;
51
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;
56
57 // Indicates if the controller draws an arrow.
58 - (BOOL)hasArrow;
59
60 // Compute preferred size for given width.
61 - (NSSize)preferredSizeForWidth:(CGFloat)width;
62
63 - (IBAction)checkboxClicked:(id)sender;
64
65 @end
66
67 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_