Home | History | Annotate | Download | only in autofill
      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_DIALOG_WINDOW_CONTROLLER_H_
      6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_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 
     14 @class AutofillHeader;
     15 @class AutofillLoadingShieldController;
     16 @class AutofillMainContainer;
     17 @class AutofillOverlayController;
     18 @class AutofillSignInContainer;
     19 
     20 namespace content {
     21 class NavigationController;
     22 class WebContents;
     23 }  // content
     24 
     25 namespace autofill {
     26 class AutofillDialogCocoa;
     27 }  // autofill
     28 
     29 
     30 // Forwarding AutofillDialogView calls.
     31 @protocol AutofillDialogBridge
     32 
     33 - (void)show;
     34 - (void)hide;
     35 - (void)updateNotificationArea;
     36 - (void)updateAccountChooser;
     37 - (void)updateButtonStrip;
     38 - (void)updateSection:(autofill::DialogSection)section;
     39 - (void)updateForErrors;
     40 - (void)fillSection:(autofill::DialogSection)section
     41            forType:(const autofill::ServerFieldType)type;
     42 - (void)getInputs:(autofill::FieldValueMap*)outputs
     43        forSection:(autofill::DialogSection)section;
     44 - (NSString*)getCvc;
     45 - (BOOL)saveDetailsLocally;
     46 - (content::NavigationController*)showSignIn;
     47 - (void)hideSignIn;
     48 - (void)modelChanged;
     49 - (void)updateErrorBubble;
     50 - (void)onSignInResize:(NSSize)size;
     51 - (void)validateSection:(autofill::DialogSection)section;
     52 
     53 @end
     54 
     55 
     56 // Window controller for AutofillDialogView.
     57 @interface AutofillDialogWindowController :
     58     NSWindowController<NSWindowDelegate, AutofillLayout, AutofillDialogBridge> {
     59  @private
     60   content::WebContents* webContents_;  // weak.
     61   autofill::AutofillDialogCocoa* dialog_;  // weak.
     62 
     63   base::scoped_nsobject<AutofillHeader> header_;
     64   base::scoped_nsobject<AutofillMainContainer> mainContainer_;
     65   base::scoped_nsobject<AutofillSignInContainer> signInContainer_;
     66   base::scoped_nsobject<AutofillOverlayController> overlayController_;
     67   base::scoped_nsobject<AutofillLoadingShieldController>
     68       loadingShieldController_;
     69   base::scoped_nsobject<NSTextView> fieldEditor_;
     70 
     71   // Signals the main container has recently become visible.
     72   BOOL mainContainerBecameVisible_;
     73 }
     74 
     75 // Designated initializer. The WebContents cannot be NULL.
     76 - (id)initWithWebContents:(content::WebContents*)webContents
     77                    dialog:(autofill::AutofillDialogCocoa*)dialog;
     78 
     79 // Requests a re-layout for the entire dialog. The layout will be postponed
     80 // until the next cycle of the runloop.
     81 - (void)requestRelayout;
     82 
     83 // Validate data. If it is valid, notify the delegate that the user would
     84 // like to use the data.
     85 - (IBAction)accept:(id)sender;
     86 
     87 // User canceled the dialog.
     88 - (IBAction)cancel:(id)sender;
     89 
     90 @end
     91 
     92 
     93 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_CONTROLLER_H_
     94