1 // Copyright (c) 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_DETAILS_CONTAINER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DETAILS_CONTAINER_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"
13 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
17 class AutofillDialogViewDelegate
;
20 @
class InfoBubbleView
;
21 @
class AutofillBubbleController
;
23 // UI controller for details for current payment instrument.
24 @interface AutofillDetailsContainer
25 : NSViewController
<AutofillLayout
,
26 AutofillValidationDisplay
> {
28 // Scroll view containing all detail sections.
29 base::scoped_nsobject
<NSScrollView
> scrollView_
;
31 // The individual detail sections.
32 base::scoped_nsobject
<NSMutableArray
> details_
;
34 // An info bubble to display validation errors.
35 base::scoped_nsobject
<InfoBubbleView
> errorBubble_
;
37 AutofillBubbleController
* errorBubbleController_
;
39 // The view the current error bubble is anchored to.
40 NSView
* errorBubbleAnchorView_
;
42 autofill::AutofillDialogViewDelegate
* delegate_
; // Not owned.
45 // Designated initializer.
46 - (id
)initWithDelegate
:(autofill::AutofillDialogViewDelegate
*)delegate
;
48 // Retrieve the container for the specified |section|.
49 - (AutofillSectionContainer
*)sectionForId
:(autofill::DialogSection
)section
;
51 // Called when |errorBubble_| needs to be updated.
52 - (void)updateErrorBubble
;
54 // Called when the delegate-maintained suggestions model has changed.
57 // Validate every visible details section.
60 // Find the first visible and invalid user input field. Returns nil if no field
61 // is found. Looks at both direct input fields and input fields in suggestions.
62 - (NSControl
*)firstInvalidField
;
64 // Finds the first visible user input field. Returns nil if no field is found.
65 // Looks at both direct input fields and input fields in suggestions.
66 - (NSControl
*)firstVisibleField
;
68 // Positions the scrollview so that given |field| is visible.
69 - (void)scrollToView
:(NSView
*)field
;
73 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DETAILS_CONTAINER_H_