Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h

Issue 135933003: rAc: split TestableAutofillDialogView implementation into its own class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with mac nits fixed Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_
7 7
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
12 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" 12 #include "chrome/browser/ui/autofill/autofill_dialog_view.h"
13 #include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h"
14 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 13 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
15 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
16 15
17 namespace content { 16 namespace content {
18 class NavigationController; 17 class NavigationController;
19 } 18 }
20 19
21 namespace autofill { 20 namespace autofill {
22 class AutofillDialogViewDelegate; 21 class AutofillDialogViewDelegate;
22 class AutofillDialogViewTesterCocoa;
23 } 23 }
24 24
25 @class AutofillDialogWindowController; 25 @class AutofillDialogWindowController;
26 26
27 namespace autofill { 27 namespace autofill {
28 28
29 class AutofillDialogCocoa : public AutofillDialogView, 29 class AutofillDialogCocoa : public AutofillDialogView,
30 public TestableAutofillDialogView,
31 public ConstrainedWindowMacDelegate { 30 public ConstrainedWindowMacDelegate {
32 public: 31 public:
33 explicit AutofillDialogCocoa(AutofillDialogViewDelegate* delegate); 32 explicit AutofillDialogCocoa(AutofillDialogViewDelegate* delegate);
34 virtual ~AutofillDialogCocoa(); 33 virtual ~AutofillDialogCocoa();
35 34
36 // AutofillDialogView implementation: 35 // AutofillDialogView implementation:
37 virtual void Show() OVERRIDE; 36 virtual void Show() OVERRIDE;
38 virtual void Hide() OVERRIDE; 37 virtual void Hide() OVERRIDE;
39 virtual void UpdatesStarted() OVERRIDE; 38 virtual void UpdatesStarted() OVERRIDE;
40 virtual void UpdatesFinished() OVERRIDE; 39 virtual void UpdatesFinished() OVERRIDE;
41 virtual void UpdateAccountChooser() OVERRIDE; 40 virtual void UpdateAccountChooser() OVERRIDE;
42 virtual void UpdateButtonStrip() OVERRIDE; 41 virtual void UpdateButtonStrip() OVERRIDE;
43 virtual void UpdateOverlay() OVERRIDE; 42 virtual void UpdateOverlay() OVERRIDE;
44 virtual void UpdateDetailArea() OVERRIDE; 43 virtual void UpdateDetailArea() OVERRIDE;
45 virtual void UpdateForErrors() OVERRIDE; 44 virtual void UpdateForErrors() OVERRIDE;
46 virtual void UpdateNotificationArea() OVERRIDE; 45 virtual void UpdateNotificationArea() OVERRIDE;
47 virtual void UpdateSection(DialogSection section) OVERRIDE; 46 virtual void UpdateSection(DialogSection section) OVERRIDE;
48 virtual void UpdateErrorBubble() OVERRIDE; 47 virtual void UpdateErrorBubble() OVERRIDE;
49 virtual void FillSection(DialogSection section, 48 virtual void FillSection(DialogSection section,
50 ServerFieldType originating_type) OVERRIDE; 49 ServerFieldType originating_type) OVERRIDE;
51 virtual void GetUserInput(DialogSection section, 50 virtual void GetUserInput(DialogSection section,
52 FieldValueMap* output) OVERRIDE; 51 FieldValueMap* output) OVERRIDE;
53 virtual base::string16 GetCvc() OVERRIDE; 52 virtual base::string16 GetCvc() OVERRIDE;
54 virtual bool HitTestInput(ServerFieldType type, 53 virtual bool HitTestInput(ServerFieldType type,
55 const gfx::Point& screen_point) OVERRIDE; 54 const gfx::Point& screen_point) OVERRIDE;
56 virtual bool SaveDetailsLocally() OVERRIDE; 55 virtual bool SaveDetailsLocally() OVERRIDE;
57 virtual const content::NavigationController* ShowSignIn() OVERRIDE; 56 virtual const content::NavigationController* ShowSignIn() OVERRIDE;
58 virtual void HideSignIn() OVERRIDE; 57 virtual void HideSignIn() OVERRIDE;
59 virtual void ModelChanged() OVERRIDE; 58 virtual void ModelChanged() OVERRIDE;
60 virtual TestableAutofillDialogView* GetTestableView() OVERRIDE;
61 virtual void OnSignInResize(const gfx::Size& pref_size) OVERRIDE; 59 virtual void OnSignInResize(const gfx::Size& pref_size) OVERRIDE;
62 60
63 // TestableAutofillDialogView implementation:
64 // TODO(groby): Create a separate class to implement the testable interface:
65 // http://crbug.com/256864
66 virtual void SubmitForTesting() OVERRIDE;
67 virtual void CancelForTesting() OVERRIDE;
68 virtual base::string16 GetTextContentsOfInput(ServerFieldType type) OVERRIDE;
69 virtual void SetTextContentsOfInput(ServerFieldType type,
70 const base::string16& contents) OVERRIDE;
71 virtual void SetTextContentsOfSuggestionInput(
72 DialogSection section,
73 const base::string16& text) OVERRIDE;
74 virtual void ActivateInput(ServerFieldType type) OVERRIDE;
75 virtual gfx::Size GetSize() const OVERRIDE;
76 virtual content::WebContents* GetSignInWebContents() OVERRIDE;
77 virtual bool IsShowingOverlay() const OVERRIDE;
78
79 // ConstrainedWindowMacDelegate implementation: 61 // ConstrainedWindowMacDelegate implementation:
80 virtual void OnConstrainedWindowClosed( 62 virtual void OnConstrainedWindowClosed(
81 ConstrainedWindowMac* window) OVERRIDE; 63 ConstrainedWindowMac* window) OVERRIDE;
82 64
83 AutofillDialogViewDelegate* delegate() { return delegate_; } 65 AutofillDialogViewDelegate* delegate() { return delegate_; }
84 66
85 // Posts a close request on the current message loop. 67 // Posts a close request on the current message loop.
86 void PerformClose(); 68 void PerformClose();
87 69
88 private: 70 private:
71 friend class AutofillDialogViewTesterCocoa;
72
89 // Closes the sheet and ends the modal loop. Triggers cleanup sequence. 73 // Closes the sheet and ends the modal loop. Triggers cleanup sequence.
90 void CloseNow(); 74 void CloseNow();
91 75
92 scoped_ptr<ConstrainedWindowMac> constrained_window_; 76 scoped_ptr<ConstrainedWindowMac> constrained_window_;
93 base::scoped_nsobject<AutofillDialogWindowController> sheet_delegate_; 77 base::scoped_nsobject<AutofillDialogWindowController> sheet_delegate_;
94 78
95 // WeakPtrFactory for deferred close. 79 // WeakPtrFactory for deferred close.
96 base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_; 80 base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_;
97 81
98 // The delegate |this| queries for logic and state. 82 // The delegate |this| queries for logic and state.
99 AutofillDialogViewDelegate* delegate_; 83 AutofillDialogViewDelegate* delegate_;
100 }; 84 };
101 85
102 } // autofill 86 } // autofill
103 87
104 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ 88 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/testable_autofill_dialog_view.h ('k') | chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698