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 AutofillTooltipController; 16@class HyperlinkTextView; 17 18namespace autofill { 19class AutofillDialogViewDelegate; 20} 21 22// Contains a single notification for requestAutocomplete dialog. 23@interface AutofillNotificationController : 24 NSViewController<AutofillLayout, NSTextViewDelegate> { 25 @private 26 // Text view for label. 27 base::scoped_nsobject<HyperlinkTextView> textview_; 28 29 // Optional checkbox. 30 base::scoped_nsobject<NSButton> checkbox_; 31 32 // Optional tooltip icon. 33 base::scoped_nsobject<AutofillTooltipController> tooltipController_; 34 35 // Optional link target. 36 GURL linkURL_; 37 38 // Notification type. 39 autofill::DialogNotification::Type notificationType_; 40 41 // Main delegate for the dialog. Weak, owns dialog. 42 autofill::AutofillDialogViewDelegate* delegate_; 43} 44 45@property(nonatomic, readonly) NSTextView* textview; 46@property(nonatomic, readonly) NSButton* checkbox; 47@property(nonatomic, readonly) NSView* tooltipView; 48 49// Designated initializer. Initializes the controller as specified by 50// |notification|. 51- (id)initWithNotification:(const autofill::DialogNotification*)notification 52 delegate:(autofill::AutofillDialogViewDelegate*)delegate; 53 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; 58 59// Indicates if the controller draws an arrow. 60- (BOOL)hasArrow; 61 62// Compute preferred size for given width. 63- (NSSize)preferredSizeForWidth:(CGFloat)width; 64 65- (IBAction)checkboxClicked:(id)sender; 66 67@end 68 69#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_NOTIFICATION_CONTROLLER_H_ 70