| OLD | NEW |
| 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" | 13 #include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h" |
| 14 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h" | 14 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h" |
| 15 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 15 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class NavigationController; | 19 class NavigationController; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace autofill { | 22 namespace autofill { |
| 23 class AutofillDialogController; | 23 class AutofillDialogViewDelegate; |
| 24 } | 24 } |
| 25 | 25 |
| 26 @class AutofillAccountChooser; | 26 @class AutofillAccountChooser; |
| 27 @class AutofillDialogWindowController; | 27 @class AutofillDialogWindowController; |
| 28 @class AutofillSignInContainer; | 28 @class AutofillSignInContainer; |
| 29 @class AutofillMainContainer; | 29 @class AutofillMainContainer; |
| 30 | 30 |
| 31 namespace autofill { | 31 namespace autofill { |
| 32 | 32 |
| 33 class AutofillDialogCocoa : public AutofillDialogView, | 33 class AutofillDialogCocoa : public AutofillDialogView, |
| 34 public TestableAutofillDialogView, | 34 public TestableAutofillDialogView, |
| 35 public ConstrainedWindowMacDelegate { | 35 public ConstrainedWindowMacDelegate { |
| 36 public: | 36 public: |
| 37 explicit AutofillDialogCocoa(AutofillDialogController* controller); | 37 explicit AutofillDialogCocoa(AutofillDialogViewDelegate* delegate); |
| 38 virtual ~AutofillDialogCocoa(); | 38 virtual ~AutofillDialogCocoa(); |
| 39 | 39 |
| 40 // AutofillDialogView implementation: | 40 // AutofillDialogView implementation: |
| 41 virtual void Show() OVERRIDE; | 41 virtual void Show() OVERRIDE; |
| 42 virtual void Hide() OVERRIDE; | 42 virtual void Hide() OVERRIDE; |
| 43 virtual void UpdateAccountChooser() OVERRIDE; | 43 virtual void UpdateAccountChooser() OVERRIDE; |
| 44 virtual void UpdateButtonStrip() OVERRIDE; | 44 virtual void UpdateButtonStrip() OVERRIDE; |
| 45 virtual void UpdateDetailArea() OVERRIDE; | 45 virtual void UpdateDetailArea() OVERRIDE; |
| 46 virtual void UpdateForErrors() OVERRIDE; | 46 virtual void UpdateForErrors() OVERRIDE; |
| 47 virtual void UpdateNotificationArea() OVERRIDE; | 47 virtual void UpdateNotificationArea() OVERRIDE; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 71 virtual void SetTextContentsOfSuggestionInput( | 71 virtual void SetTextContentsOfSuggestionInput( |
| 72 DialogSection section, | 72 DialogSection section, |
| 73 const base::string16& text) OVERRIDE; | 73 const base::string16& text) OVERRIDE; |
| 74 virtual void ActivateInput(const DetailInput& input) OVERRIDE; | 74 virtual void ActivateInput(const DetailInput& input) OVERRIDE; |
| 75 virtual gfx::Size GetSize() const OVERRIDE; | 75 virtual gfx::Size GetSize() const OVERRIDE; |
| 76 | 76 |
| 77 // ConstrainedWindowMacDelegate implementation: | 77 // ConstrainedWindowMacDelegate implementation: |
| 78 virtual void OnConstrainedWindowClosed( | 78 virtual void OnConstrainedWindowClosed( |
| 79 ConstrainedWindowMac* window) OVERRIDE; | 79 ConstrainedWindowMac* window) OVERRIDE; |
| 80 | 80 |
| 81 AutofillDialogController* controller() { return controller_; } | 81 AutofillDialogViewDelegate* delegate() { return delegate_; } |
| 82 | 82 |
| 83 // Posts a close request on the current message loop. | 83 // Posts a close request on the current message loop. |
| 84 void PerformClose(); | 84 void PerformClose(); |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // Closes the sheet and ends the modal loop. Triggers cleanup sequence. | 87 // Closes the sheet and ends the modal loop. Triggers cleanup sequence. |
| 88 void CloseNow(); | 88 void CloseNow(); |
| 89 | 89 |
| 90 scoped_ptr<ConstrainedWindowMac> constrained_window_; | 90 scoped_ptr<ConstrainedWindowMac> constrained_window_; |
| 91 base::scoped_nsobject<AutofillDialogWindowController> sheet_controller_; | 91 base::scoped_nsobject<AutofillDialogWindowController> sheet_delegate_; |
| 92 | 92 |
| 93 // WeakPtrFactory for deferred close. | 93 // WeakPtrFactory for deferred close. |
| 94 base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_; | 94 base::WeakPtrFactory<AutofillDialogCocoa> close_weak_ptr_factory_; |
| 95 | 95 |
| 96 // The controller |this| queries for logic and state. | 96 // The delegate |this| queries for logic and state. |
| 97 AutofillDialogController* controller_; | 97 AutofillDialogViewDelegate* delegate_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // autofill | 100 } // autofill |
| 101 | 101 |
| 102 @interface AutofillDialogWindowController : | 102 @interface AutofillDialogWindowController : |
| 103 NSWindowController<NSWindowDelegate, AutofillLayout> { | 103 NSWindowController<NSWindowDelegate, AutofillLayout> { |
| 104 @private | 104 @private |
| 105 content::WebContents* webContents_; // weak. | 105 content::WebContents* webContents_; // weak. |
| 106 autofill::AutofillDialogCocoa* autofillDialog_; // weak. | 106 autofill::AutofillDialogCocoa* autofillDialog_; // weak. |
| 107 | 107 |
| 108 base::scoped_nsobject<AutofillMainContainer> mainContainer_; | 108 base::scoped_nsobject<AutofillMainContainer> mainContainer_; |
| 109 base::scoped_nsobject<AutofillSignInContainer> signInContainer_; | 109 base::scoped_nsobject<AutofillSignInContainer> signInContainer_; |
| 110 base::scoped_nsobject<AutofillAccountChooser> accountChooser_; | 110 base::scoped_nsobject<AutofillAccountChooser> accountChooser_; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Designated initializer. The WebContents cannot be NULL. | 113 // Designated initializer. The WebContents cannot be NULL. |
| 114 - (id)initWithWebContents:(content::WebContents*)webContents | 114 - (id)initWithWebContents:(content::WebContents*)webContents |
| 115 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog; | 115 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog; |
| 116 | 116 |
| 117 // A child view request re-layouting. | 117 // A child view request re-layouting. |
| 118 - (void)requestRelayout; | 118 - (void)requestRelayout; |
| 119 | 119 |
| 120 // Validate data. If it is valid, notify the controller that the user would | 120 // Validate data. If it is valid, notify the delegate that the user would |
| 121 // like to use the data. | 121 // like to use the data. |
| 122 - (IBAction)accept:(id)sender; | 122 - (IBAction)accept:(id)sender; |
| 123 | 123 |
| 124 // User cancels dialog. | 124 // User cancels dialog. |
| 125 - (IBAction)cancel:(id)sender; | 125 - (IBAction)cancel:(id)sender; |
| 126 | 126 |
| 127 // Forwarding AutofillDialogView calls. | 127 // Forwarding AutofillDialogView calls. |
| 128 - (void)hide; | 128 - (void)hide; |
| 129 - (void)updateNotificationArea; | 129 - (void)updateNotificationArea; |
| 130 - (void)updateAccountChooser; | 130 - (void)updateAccountChooser; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 146 | 146 |
| 147 - (void)setTextContents:(NSString*)text | 147 - (void)setTextContents:(NSString*)text |
| 148 forInput:(const autofill::DetailInput&)input; | 148 forInput:(const autofill::DetailInput&)input; |
| 149 - (void)setTextContents:(NSString*)text | 149 - (void)setTextContents:(NSString*)text |
| 150 ofSuggestionForSection:(autofill::DialogSection)section; | 150 ofSuggestionForSection:(autofill::DialogSection)section; |
| 151 - (void)activateFieldForInput:(const autofill::DetailInput&)input; | 151 - (void)activateFieldForInput:(const autofill::DetailInput&)input; |
| 152 | 152 |
| 153 @end | 153 @end |
| 154 | 154 |
| 155 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ | 155 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_COCOA_H_ |
| OLD | NEW |