Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / autofill / autofill_dialog_cocoa.h
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 "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/size.h"
15
16 namespace content {
17 class NavigationController;
18 }
19
20 namespace autofill {
21 class AutofillDialogViewDelegate;
22 class AutofillDialogViewTesterCocoa;
23 }
24
25 @class AutofillDialogWindowController;
26
27 namespace autofill {
28
29 class AutofillDialogCocoa : public AutofillDialogView,
30                             public ConstrainedWindowMacDelegate {
31  public:
32   explicit AutofillDialogCocoa(AutofillDialogViewDelegate* delegate);
33   ~AutofillDialogCocoa() override;
34
35   // AutofillDialogView implementation:
36   void Show() override;
37   void Hide() override;
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;
58
59   // ConstrainedWindowMacDelegate implementation:
60   void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override;
61
62   AutofillDialogViewDelegate* delegate() { return delegate_; }
63
64   // Posts a close request on the current message loop.
65   void PerformClose();
66
67  private:
68   friend class AutofillDialogViewTesterCocoa;
69
70   // Closes the sheet and ends the modal loop. Triggers cleanup sequence.
71   void CloseNow();
72
73   scoped_ptr<ConstrainedWindowMac> constrained_window_;
74   base::scoped_nsobject<AutofillDialogWindowController> sheet_delegate_;
75
76   // The delegate |this| queries for logic and state.
77   AutofillDialogViewDelegate* delegate_;
78
79   // WeakPtrFactory for deferred close.
80   base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_;
81
82 };
83
84 }  // autofill
85
86 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_