| 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/ui/app_modal_dialogs/js_modal_dialog.h" | 5 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
| 6 | 6 |
| 7 #include "app/text_elider.h" |
| 7 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 8 #include "chrome/browser/browser_shutdown.h" | 9 #include "chrome/browser/browser_shutdown.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 11 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 12 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
| 12 #include "chrome/common/notification_service.h" | 13 #include "chrome/common/notification_service.h" |
| 13 #include "chrome/common/notification_type.h" | 14 #include "chrome/common/notification_type.h" |
| 14 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 IPC::Message* reply_msg) | 33 IPC::Message* reply_msg) |
| 33 : AppModalDialog(delegate->AsTabContents(), title), | 34 : AppModalDialog(delegate->AsTabContents(), title), |
| 34 delegate_(delegate), | 35 delegate_(delegate), |
| 35 extension_host_(delegate->AsExtensionHost()), | 36 extension_host_(delegate->AsExtensionHost()), |
| 36 dialog_flags_(dialog_flags), | 37 dialog_flags_(dialog_flags), |
| 37 display_suppress_checkbox_(display_suppress_checkbox), | 38 display_suppress_checkbox_(display_suppress_checkbox), |
| 38 is_before_unload_dialog_(is_before_unload_dialog), | 39 is_before_unload_dialog_(is_before_unload_dialog), |
| 39 reply_msg_(reply_msg) { | 40 reply_msg_(reply_msg) { |
| 40 // We trim the various parts of the message dialog because otherwise we can | 41 // We trim the various parts of the message dialog because otherwise we can |
| 41 // overflow the message dialog (and crash/hang the GTK+ version). | 42 // overflow the message dialog (and crash/hang the GTK+ version). |
| 42 ElideString(message_text, kMessageTextMaxSize, &message_text_); | 43 gfx::ElideString(message_text, kMessageTextMaxSize, &message_text_); |
| 43 ElideString(default_prompt_text, kDefaultPromptTextSize, | 44 gfx::ElideString(default_prompt_text, kDefaultPromptTextSize, |
| 44 &default_prompt_text_); | 45 &default_prompt_text_); |
| 45 | 46 |
| 46 DCHECK((tab_contents_ != NULL) != (extension_host_ != NULL)); | 47 DCHECK((tab_contents_ != NULL) != (extension_host_ != NULL)); |
| 47 InitNotifications(); | 48 InitNotifications(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 JavaScriptAppModalDialog::~JavaScriptAppModalDialog() { | 51 JavaScriptAppModalDialog::~JavaScriptAppModalDialog() { |
| 51 } | 52 } |
| 52 | 53 |
| 53 NativeAppModalDialog* JavaScriptAppModalDialog::CreateNativeDialog() { | 54 NativeAppModalDialog* JavaScriptAppModalDialog::CreateNativeDialog() { |
| 54 gfx::NativeWindow parent_window = tab_contents_ ? | 55 gfx::NativeWindow parent_window = tab_contents_ ? |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return; | 131 return; |
| 131 | 132 |
| 132 delegate_->OnMessageBoxClosed(reply_msg_, success, prompt_text); | 133 delegate_->OnMessageBoxClosed(reply_msg_, success, prompt_text); |
| 133 if (suppress_js_messages) | 134 if (suppress_js_messages) |
| 134 delegate_->SetSuppressMessageBoxes(true); | 135 delegate_->SetSuppressMessageBoxes(true); |
| 135 | 136 |
| 136 // On Views, we can end up coming through this code path twice :(. | 137 // On Views, we can end up coming through this code path twice :(. |
| 137 // See crbug.com/63732. | 138 // See crbug.com/63732. |
| 138 skip_this_dialog_ = true; | 139 skip_this_dialog_ = true; |
| 139 } | 140 } |
| OLD | NEW |