| 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> |
| 8 |
| 7 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 8 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" | 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" |
| 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
| 11 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" | 13 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" |
| 12 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 14 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 13 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 14 #include "ui/base/cocoa/cocoa_base_utils.h" | 16 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 15 #include "ui/base/l10n/l10n_util_mac.h" | 17 #include "ui/base/l10n/l10n_util_mac.h" |
| 16 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 window_->CloseWebContentsModalDialog(); | 115 window_->CloseWebContentsModalDialog(); |
| 114 } | 116 } |
| 115 } | 117 } |
| 116 | 118 |
| 117 void TabModalConfirmDialogMac::OnConstrainedWindowClosed( | 119 void TabModalConfirmDialogMac::OnConstrainedWindowClosed( |
| 118 ConstrainedWindowMac* window) { | 120 ConstrainedWindowMac* window) { |
| 119 // If this method should mistakenly be called during Delegate::Close(), | 121 // If this method should mistakenly be called during Delegate::Close(), |
| 120 // prevent a double-delete by moving delegate_ to a stack variable. | 122 // prevent a double-delete by moving delegate_ to a stack variable. |
| 121 if (!delegate_) | 123 if (!delegate_) |
| 122 return; | 124 return; |
| 123 scoped_ptr<TabModalConfirmDialogDelegate> delegate(delegate_.Pass()); | 125 scoped_ptr<TabModalConfirmDialogDelegate> delegate(std::move(delegate_)); |
| 124 // 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 |
| 125 // cancelling. | 127 // cancelling. |
| 126 delegate->Close(); | 128 delegate->Close(); |
| 127 delete this; | 129 delete this; |
| 128 } | 130 } |
| OLD | NEW |