Upstream version 5.34.104.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   virtual ~AutofillDialogCocoa();
34
35   // AutofillDialogView implementation:
36   virtual void Show() OVERRIDE;
37   virtual void Hide() OVERRIDE;
38   virtual void UpdatesStarted() OVERRIDE;
39   virtual void UpdatesFinished() OVERRIDE;
40   virtual void UpdateAccountChooser() OVERRIDE;
41   virtual void UpdateButtonStrip() OVERRIDE;
42   virtual void UpdateOverlay() OVERRIDE;
43   virtual void UpdateDetailArea() OVERRIDE;
44   virtual void UpdateForErrors() OVERRIDE;
45   virtual void UpdateNotificationArea() OVERRIDE;
46   virtual void UpdateSection(DialogSection section) OVERRIDE;
47   virtual void UpdateErrorBubble() OVERRIDE;
48   virtual void FillSection(DialogSection section,
49                            ServerFieldType originating_type) OVERRIDE;
50   virtual void GetUserInput(DialogSection section,
51                             FieldValueMap* output) OVERRIDE;
52   virtual base::string16 GetCvc() OVERRIDE;
53   virtual bool HitTestInput(ServerFieldType type,
54                             const gfx::Point& screen_point) OVERRIDE;
55   virtual bool SaveDetailsLocally() OVERRIDE;
56   virtual const content::NavigationController* ShowSignIn() OVERRIDE;
57   virtual void HideSignIn() OVERRIDE;
58   virtual void ModelChanged() OVERRIDE;
59   virtual void OnSignInResize(const gfx::Size& pref_size) OVERRIDE;
60   virtual void ValidateSection(DialogSection section) OVERRIDE;
61
62   // ConstrainedWindowMacDelegate implementation:
63   virtual void OnConstrainedWindowClosed(
64       ConstrainedWindowMac* window) OVERRIDE;
65
66   AutofillDialogViewDelegate* delegate() { return delegate_; }
67
68   // Posts a close request on the current message loop.
69   void PerformClose();
70
71  private:
72   friend class AutofillDialogViewTesterCocoa;
73
74   // Closes the sheet and ends the modal loop. Triggers cleanup sequence.
75   void CloseNow();
76
77   scoped_ptr<ConstrainedWindowMac> constrained_window_;
78   base::scoped_nsobject<AutofillDialogWindowController> sheet_delegate_;
79
80   // WeakPtrFactory for deferred close.
81   base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_;
82
83   // The delegate |this| queries for logic and state.
84   AutofillDialogViewDelegate* delegate_;
85 };
86
87 }  // autofill
88
89 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_