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 UpdateAccountChooser() override
;
41 void UpdateButtonStrip() override
;
42 void UpdateOverlay() override
;
43 void UpdateDetailArea() override
;
44 void UpdateForErrors() override
;
45 void UpdateNotificationArea() override
;
46 void UpdateSection(DialogSection section
) override
;
47 void UpdateErrorBubble() override
;
48 void FillSection(DialogSection section
,
49 ServerFieldType originating_type
) override
;
50 void GetUserInput(DialogSection section
, FieldValueMap
* output
) override
;
51 base::string16
GetCvc() override
;
52 bool SaveDetailsLocally() override
;
53 const content::NavigationController
* ShowSignIn(const GURL
& url
) override
;
54 void HideSignIn() override
;
55 void ModelChanged() override
;
56 void OnSignInResize(const gfx::Size
& pref_size
) override
;
57 void ValidateSection(DialogSection section
) override
;
59 // ConstrainedWindowMacDelegate implementation:
60 void OnConstrainedWindowClosed(ConstrainedWindowMac
* window
) override
;
62 AutofillDialogViewDelegate
* delegate() { return delegate_
; }
64 // Posts a close request on the current message loop.
68 friend class AutofillDialogViewTesterCocoa
;
70 // Closes the sheet and ends the modal loop. Triggers cleanup sequence.
73 scoped_ptr
<ConstrainedWindowMac
> constrained_window_
;
74 base::scoped_nsobject
<AutofillDialogWindowController
> sheet_delegate_
;
76 // The delegate |this| queries for logic and state.
77 AutofillDialogViewDelegate
* delegate_
;
79 // WeakPtrFactory for deferred close.
80 base::WeakPtrFactory
<AutofillDialogCocoa
> close_weak_ptr_factory_
;
86 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_