OLD | NEW |
| (Empty) |
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_DIALOG_COCOA_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/mac/scoped_nsobject.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | |
13 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | |
14 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | |
15 #include "ui/gfx/geometry/size.h" | |
16 | |
17 namespace content { | |
18 class NavigationController; | |
19 } | |
20 | |
21 namespace autofill { | |
22 class AutofillDialogViewDelegate; | |
23 class AutofillDialogViewTesterCocoa; | |
24 } | |
25 | |
26 @class AutofillDialogWindowController; | |
27 | |
28 namespace autofill { | |
29 | |
30 class AutofillDialogCocoa : public AutofillDialogView, | |
31 public ConstrainedWindowMacDelegate { | |
32 public: | |
33 explicit AutofillDialogCocoa(AutofillDialogViewDelegate* delegate); | |
34 ~AutofillDialogCocoa() override; | |
35 | |
36 // AutofillDialogView implementation: | |
37 void Show() override; | |
38 void Hide() override; | |
39 void UpdatesStarted() override; | |
40 void UpdatesFinished() override; | |
41 void UpdateButtonStrip() override; | |
42 void UpdateDetailArea() override; | |
43 void UpdateForErrors() override; | |
44 void UpdateNotificationArea() override; | |
45 void UpdateSection(DialogSection section) override; | |
46 void UpdateErrorBubble() override; | |
47 void FillSection(DialogSection section, | |
48 ServerFieldType originating_type) override; | |
49 void GetUserInput(DialogSection section, FieldValueMap* output) override; | |
50 base::string16 GetCvc() override; | |
51 bool SaveDetailsLocally() override; | |
52 void ModelChanged() override; | |
53 void ValidateSection(DialogSection section) override; | |
54 | |
55 // ConstrainedWindowMacDelegate implementation: | |
56 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; | |
57 | |
58 AutofillDialogViewDelegate* delegate() { return delegate_; } | |
59 | |
60 // Posts a close request on the current message loop. | |
61 void PerformClose(); | |
62 | |
63 private: | |
64 friend class AutofillDialogViewTesterCocoa; | |
65 | |
66 // Closes the sheet and ends the modal loop. Triggers cleanup sequence. | |
67 void CloseNow(); | |
68 | |
69 std::unique_ptr<ConstrainedWindowMac> constrained_window_; | |
70 base::scoped_nsobject<AutofillDialogWindowController> sheet_delegate_; | |
71 | |
72 // The delegate |this| queries for logic and state. | |
73 AutofillDialogViewDelegate* delegate_; | |
74 | |
75 // WeakPtrFactory for deferred close. | |
76 base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_; | |
77 | |
78 }; | |
79 | |
80 } // autofill | |
81 | |
82 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ | |
OLD | NEW |