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_DIALOG_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_
8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
12 #include "chrome/browser/ui/autofill/autofill_dialog_view.h"
13 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
14 #include "ui/gfx/geometry/size.h"
17 class NavigationController
;
21 class AutofillDialogViewDelegate
;
22 class AutofillDialogViewTesterCocoa
;
25 @
class AutofillDialogWindowController
;
29 class AutofillDialogCocoa
: public AutofillDialogView
,
30 public ConstrainedWindowMacDelegate
{
32 explicit AutofillDialogCocoa(AutofillDialogViewDelegate
* delegate
);
33 ~AutofillDialogCocoa() override
;
35 // AutofillDialogView implementation:
38 void UpdatesStarted() override
;
39 void UpdatesFinished() override
;
40 void UpdateButtonStrip() override
;
41 void UpdateDetailArea() override
;
42 void UpdateForErrors() override
;
43 void UpdateNotificationArea() override
;
44 void UpdateSection(DialogSection section
) override
;
45 void UpdateErrorBubble() override
;
46 void FillSection(DialogSection section
,
47 ServerFieldType originating_type
) override
;
48 void GetUserInput(DialogSection section
, FieldValueMap
* output
) override
;
49 base::string16
GetCvc() override
;
50 bool SaveDetailsLocally() override
;
51 void ModelChanged() override
;
52 void ValidateSection(DialogSection section
) override
;
54 // ConstrainedWindowMacDelegate implementation:
55 void OnConstrainedWindowClosed(ConstrainedWindowMac
* window
) override
;
57 AutofillDialogViewDelegate
* delegate() { return delegate_
; }
59 // Posts a close request on the current message loop.
63 friend class AutofillDialogViewTesterCocoa
;
65 // Closes the sheet and ends the modal loop. Triggers cleanup sequence.
68 scoped_ptr
<ConstrainedWindowMac
> constrained_window_
;
69 base::scoped_nsobject
<AutofillDialogWindowController
> sheet_delegate_
;
71 // The delegate |this| queries for logic and state.
72 AutofillDialogViewDelegate
* delegate_
;
74 // WeakPtrFactory for deferred close.
75 base::WeakPtrFactory
<AutofillDialogCocoa
> close_weak_ptr_factory_
;
81 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_