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" |
11 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 11 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
12 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" | 12 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
13 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h" | 13 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_window_controller.h" |
14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 | 17 |
18 // static | 18 // static |
19 AutofillDialogView* AutofillDialogView::Create( | 19 AutofillDialogView* AutofillDialogView::Create( |
20 AutofillDialogViewDelegate* delegate) { | 20 AutofillDialogViewDelegate* delegate) { |
21 return new AutofillDialogCocoa(delegate); | 21 return new AutofillDialogCocoa(delegate); |
22 } | 22 } |
23 | 23 |
24 AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogViewDelegate* delegate) | 24 AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogViewDelegate* delegate) |
25 : close_weak_ptr_factory_(this), | 25 : delegate_(delegate), |
26 delegate_(delegate) { | 26 close_weak_ptr_factory_(this) { |
27 } | 27 } |
28 | 28 |
29 AutofillDialogCocoa::~AutofillDialogCocoa() { | 29 AutofillDialogCocoa::~AutofillDialogCocoa() { |
30 } | 30 } |
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() |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 void AutofillDialogCocoa::OnConstrainedWindowClosed( | 140 void AutofillDialogCocoa::OnConstrainedWindowClosed( |
141 ConstrainedWindowMac* window) { | 141 ConstrainedWindowMac* window) { |
142 constrained_window_.reset(); | 142 constrained_window_.reset(); |
143 // |this| belongs to |delegate_|, so no self-destruction here. | 143 // |this| belongs to |delegate_|, so no self-destruction here. |
144 delegate_->ViewClosed(); | 144 delegate_->ViewClosed(); |
145 } | 145 } |
146 | 146 |
147 } // autofill | 147 } // autofill |
OLD | NEW |