OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_modal_confirm_dialog_mac.h" | 5 #include "chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 keyEquivalent:kKeyEquivalentEscape | 87 keyEquivalent:kKeyEquivalentEscape |
88 target:bridge_ | 88 target:bridge_ |
89 action:@selector(onCancelButton:)]; | 89 action:@selector(onCancelButton:)]; |
90 [[alert_ closeButton] setTarget:bridge_]; | 90 [[alert_ closeButton] setTarget:bridge_]; |
91 [[alert_ closeButton] setAction:@selector(onCloseButton:)]; | 91 [[alert_ closeButton] setAction:@selector(onCloseButton:)]; |
92 [alert_ layout]; | 92 [alert_ layout]; |
93 | 93 |
94 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 94 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
95 [[CustomConstrainedWindowSheet alloc] | 95 [[CustomConstrainedWindowSheet alloc] |
96 initWithCustomWindow:[alert_ window]]); | 96 initWithCustomWindow:[alert_ window]]); |
97 window_ = CreateAndShowWebModalDialogMac(this, web_contents, sheet); | 97 window_.reset(new ConstrainedWindowMac(this, web_contents, sheet)); |
98 delegate_->set_close_delegate(this); | 98 delegate_->set_close_delegate(this); |
99 } | 99 } |
100 | 100 |
101 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { | 101 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { |
102 } | 102 } |
103 | 103 |
104 void TabModalConfirmDialogMac::AcceptTabModalDialog() { | 104 void TabModalConfirmDialogMac::AcceptTabModalDialog() { |
105 delegate_->Accept(); | 105 delegate_->Accept(); |
106 } | 106 } |
107 | 107 |
(...skipping 13 matching lines...) Expand all Loading... |
121 // If this method should mistakenly be called during Delegate::Close(), | 121 // If this method should mistakenly be called during Delegate::Close(), |
122 // prevent a double-delete by moving delegate_ to a stack variable. | 122 // prevent a double-delete by moving delegate_ to a stack variable. |
123 if (!delegate_) | 123 if (!delegate_) |
124 return; | 124 return; |
125 scoped_ptr<TabModalConfirmDialogDelegate> delegate(std::move(delegate_)); | 125 scoped_ptr<TabModalConfirmDialogDelegate> delegate(std::move(delegate_)); |
126 // Provide a disposition in case the dialog was closed without accepting or | 126 // Provide a disposition in case the dialog was closed without accepting or |
127 // cancelling. | 127 // cancelling. |
128 delegate->Close(); | 128 delegate->Close(); |
129 delete this; | 129 delete this; |
130 } | 130 } |
OLD | NEW |