| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/js_modal_dialog.h" | 5 #include "chrome/browser/js_modal_dialog.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/browser_shutdown.h" |
| 8 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 9 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| 10 #include "chrome/common/notification_service.h" | 11 #include "chrome/common/notification_service.h" |
| 11 #include "chrome/common/notification_type.h" | 12 #include "chrome/common/notification_type.h" |
| 12 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // The maximum sizes of various texts passed to us from javascript. | 17 // The maximum sizes of various texts passed to us from javascript. |
| 17 const int kMessageTextMaxSize = 3000; | 18 const int kMessageTextMaxSize = 3000; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // EXTENSION_HOST_DESTROYED uses the Profile as its source, but we care | 84 // EXTENSION_HOST_DESTROYED uses the Profile as its source, but we care |
| 84 // about the ExtensionHost (which is passed in the details). | 85 // about the ExtensionHost (which is passed in the details). |
| 85 registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED, | 86 registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED, |
| 86 NotificationService::AllSources()); | 87 NotificationService::AllSources()); |
| 87 } else { | 88 } else { |
| 88 NOTREACHED(); | 89 NOTREACHED(); |
| 89 } | 90 } |
| 90 } | 91 } |
| 91 | 92 |
| 92 void JavaScriptAppModalDialog::OnCancel() { | 93 void JavaScriptAppModalDialog::OnCancel() { |
| 94 // If we are shutting down and this is an onbeforeunload dialog, cancel the |
| 95 // shutdown. |
| 96 if (is_before_unload_dialog_) |
| 97 browser_shutdown::SetTryingToQuit(false); |
| 98 |
| 93 // We need to do this before WM_DESTROY (WindowClosing()) as any parent frame | 99 // We need to do this before WM_DESTROY (WindowClosing()) as any parent frame |
| 94 // will receive its activation messages before this dialog receives | 100 // will receive its activation messages before this dialog receives |
| 95 // WM_DESTROY. The parent frame would then try to activate any modal dialogs | 101 // WM_DESTROY. The parent frame would then try to activate any modal dialogs |
| 96 // that were still open in the ModalDialogQueue, which would send activation | 102 // that were still open in the ModalDialogQueue, which would send activation |
| 97 // back to this one. The framework should be improved to handle this, so this | 103 // back to this one. The framework should be improved to handle this, so this |
| 98 // is a temporary workaround. | 104 // is a temporary workaround. |
| 99 CompleteDialog(); | 105 CompleteDialog(); |
| 100 | 106 |
| 101 if (!skip_this_dialog_) { | 107 if (!skip_this_dialog_) { |
| 102 client_->OnMessageBoxClosed(reply_msg_, false, std::wstring()); | 108 client_->OnMessageBoxClosed(reply_msg_, false, std::wstring()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 133 // state, destroying the host. http://crbug.com/29355 | 139 // state, destroying the host. http://crbug.com/29355 |
| 134 #if !defined(OS_MACOSX) | 140 #if !defined(OS_MACOSX) |
| 135 else if (extension_host_) | 141 else if (extension_host_) |
| 136 extension_host_->OnMessageBoxClosed(reply_msg_, false, L""); | 142 extension_host_->OnMessageBoxClosed(reply_msg_, false, L""); |
| 137 else | 143 else |
| 138 NOTREACHED(); | 144 NOTREACHED(); |
| 139 #endif | 145 #endif |
| 140 } | 146 } |
| 141 AppModalDialog::Cleanup(); | 147 AppModalDialog::Cleanup(); |
| 142 } | 148 } |
| OLD | NEW |