| 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 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // Cancel potential relayout requests, since the AutofillDialogController | 30 // Cancel potential relayout requests, since the AutofillDialogController |
| 31 // is about to go away, but relayout requests assume it will still exist. | 31 // is about to go away, but relayout requests assume it will still exist. |
| 32 [sheet_delegate_ cancelRelayout]; | 32 [sheet_delegate_ cancelRelayout]; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void AutofillDialogCocoa::Show() { | 35 void AutofillDialogCocoa::Show() { |
| 36 // This should only be called once. | 36 // This should only be called once. |
| 37 DCHECK(!sheet_delegate_.get()); | 37 DCHECK(!sheet_delegate_.get()); |
| 38 sheet_delegate_.reset([[AutofillDialogWindowController alloc] | 38 sheet_delegate_.reset([[AutofillDialogWindowController alloc] |
| 39 initWithWebContents:delegate_->GetWebContents() | 39 initWithWebContents:delegate_->GetWebContents() |
| 40 autofillDialog:this]); | 40 dialog:this]); |
| 41 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 41 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
| 42 [[CustomConstrainedWindowSheet alloc] | 42 [[CustomConstrainedWindowSheet alloc] |
| 43 initWithCustomWindow:[sheet_delegate_ window]]); | 43 initWithCustomWindow:[sheet_delegate_ window]]); |
| 44 constrained_window_.reset( | 44 constrained_window_.reset( |
| 45 new ConstrainedWindowMac(this, delegate_->GetWebContents(), sheet)); | 45 new ConstrainedWindowMac(this, delegate_->GetWebContents(), sheet)); |
| 46 [sheet_delegate_ show]; | 46 [sheet_delegate_ show]; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void AutofillDialogCocoa::Hide() { | 49 void AutofillDialogCocoa::Hide() { |
| 50 [sheet_delegate_ hide]; | 50 [sheet_delegate_ hide]; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 void AutofillDialogCocoa::OnConstrainedWindowClosed( | 200 void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| 201 ConstrainedWindowMac* window) { | 201 ConstrainedWindowMac* window) { |
| 202 constrained_window_.reset(); | 202 constrained_window_.reset(); |
| 203 // |this| belongs to |delegate_|, so no self-destruction here. | 203 // |this| belongs to |delegate_|, so no self-destruction here. |
| 204 delegate_->ViewClosed(); | 204 delegate_->ViewClosed(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // autofill | 207 } // autofill |
| OLD | NEW |