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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 void AutofillDialogCocoa::Show() { | 32 void AutofillDialogCocoa::Show() { |
33 // This should only be called once. | 33 // This should only be called once. |
34 DCHECK(!sheet_delegate_.get()); | 34 DCHECK(!sheet_delegate_.get()); |
35 sheet_delegate_.reset([[AutofillDialogWindowController alloc] | 35 sheet_delegate_.reset([[AutofillDialogWindowController alloc] |
36 initWithWebContents:delegate_->GetWebContents() | 36 initWithWebContents:delegate_->GetWebContents() |
37 dialog:this]); | 37 dialog:this]); |
38 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 38 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
39 [[CustomConstrainedWindowSheet alloc] | 39 [[CustomConstrainedWindowSheet alloc] |
40 initWithCustomWindow:[sheet_delegate_ window]]); | 40 initWithCustomWindow:[sheet_delegate_ window]]); |
41 constrained_window_.reset( | 41 constrained_window_ = |
42 new ConstrainedWindowMac(this, delegate_->GetWebContents(), sheet)); | 42 CreateAndShowWebModalDialogMac(this, delegate_->GetWebContents(), sheet); |
43 [sheet_delegate_ show]; | 43 [sheet_delegate_ show]; |
44 } | 44 } |
45 | 45 |
46 void AutofillDialogCocoa::Hide() { | 46 void AutofillDialogCocoa::Hide() { |
47 [sheet_delegate_ hide]; | 47 [sheet_delegate_ hide]; |
48 } | 48 } |
49 | 49 |
50 void AutofillDialogCocoa::PerformClose() { | 50 void AutofillDialogCocoa::PerformClose() { |
51 if (!close_weak_ptr_factory_.HasWeakPtrs()) { | 51 if (!close_weak_ptr_factory_.HasWeakPtrs()) { |
52 base::MessageLoop::current()->PostTask( | 52 base::MessageLoop::current()->PostTask( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 void AutofillDialogCocoa::OnConstrainedWindowClosed( | 117 void AutofillDialogCocoa::OnConstrainedWindowClosed( |
118 ConstrainedWindowMac* window) { | 118 ConstrainedWindowMac* window) { |
119 constrained_window_.reset(); | 119 constrained_window_.reset(); |
120 // |this| belongs to |delegate_|, so no self-destruction here. | 120 // |this| belongs to |delegate_|, so no self-destruction here. |
121 delegate_->ViewClosed(); | 121 delegate_->ViewClosed(); |
122 } | 122 } |
123 | 123 |
124 } // autofill | 124 } // autofill |
OLD | NEW |