Home | History | Annotate | Download | only in autofill
      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.
      4 
      5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DETAILS_CONTAINER_H_
      6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DETAILS_CONTAINER_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 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
     14 
     15 
     16 namespace autofill {
     17 class AutofillDialogViewDelegate;
     18 }
     19 
     20 @class InfoBubbleView;
     21 @class AutofillBubbleController;
     22 
     23 // UI controller for details for current payment instrument.
     24 @interface AutofillDetailsContainer
     25     : NSViewController<AutofillLayout,
     26                        AutofillValidationDisplay> {
     27  @private
     28   // Scroll view containing all detail sections.
     29   base::scoped_nsobject<NSScrollView> scrollView_;
     30 
     31   // The individual detail sections.
     32   base::scoped_nsobject<NSMutableArray> details_;
     33 
     34   // An info bubble to display validation errors.
     35   base::scoped_nsobject<InfoBubbleView> errorBubble_;
     36 
     37   AutofillBubbleController* errorBubbleController_;
     38 
     39   // The view the current error bubble is anchored to.
     40   NSView* errorBubbleAnchorView_;
     41 
     42   autofill::AutofillDialogViewDelegate* delegate_;  // Not owned.
     43 }
     44 
     45 // Designated initializer.
     46 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
     47 
     48 // Retrieve the container for the specified |section|.
     49 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section;
     50 
     51 // Called when |errorBubble_| needs to be updated.
     52 - (void)updateErrorBubble;
     53 
     54 // Called when the delegate-maintained suggestions model has changed.
     55 - (void)modelChanged;
     56 
     57 // Validate every visible details section.
     58 - (BOOL)validate;
     59 
     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;
     63 
     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;
     67 
     68 // Positions the scrollview so that given |field| is visible.
     69 - (void)scrollToView:(NSView*)field;
     70 
     71 @end
     72 
     73 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DETAILS_CONTAINER_H_
     74