| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 window_->CloseWebContentsModalDialog(); | 115 window_->CloseWebContentsModalDialog(); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 void TabModalConfirmDialogMac::OnConstrainedWindowClosed( | 119 void TabModalConfirmDialogMac::OnConstrainedWindowClosed( |
| 120 ConstrainedWindowMac* window) { | 120 ConstrainedWindowMac* window) { |
| 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 std::unique_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 |