| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/jsmessage_box_handler.h" | 5 #include "chrome/browser/jsmessage_box_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/app_modal_dialog_queue.h" | 7 #include "chrome/browser/app_modal_dialog_queue.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/web_contents.h" | 9 #include "chrome/browser/web_contents.h" |
| 10 #include "chrome/common/gfx/url_elider.h" | 10 #include "chrome/common/gfx/url_elider.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // handling without getting the accept language from the profil. | 80 // handling without getting the accept language from the profil. |
| 81 std::wstring base_address = gfx::ElideUrl(clean_url, ChromeFont(), 0, | 81 std::wstring base_address = gfx::ElideUrl(clean_url, ChromeFont(), 0, |
| 82 web_contents_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 82 web_contents_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
| 83 return l10n_util::GetStringF(IDS_JAVASCRIPT_MESSAGEBOX_TITLE, base_address); | 83 return l10n_util::GetStringF(IDS_JAVASCRIPT_MESSAGEBOX_TITLE, base_address); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void JavascriptMessageBoxHandler::WindowClosing() { | 86 void JavascriptMessageBoxHandler::WindowClosing() { |
| 87 dialog_ = NULL; | 87 dialog_ = NULL; |
| 88 | 88 |
| 89 if (message_box_view_->IsCheckBoxSelected() && web_contents_) | 89 if (message_box_view_->IsCheckBoxSelected() && web_contents_) |
| 90 web_contents_->SetSuppressJavascriptMessageBoxes(true); | 90 web_contents_->set_suppress_javascript_messages(true); |
| 91 | 91 |
| 92 delete this; | 92 delete this; |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool JavascriptMessageBoxHandler::Cancel() { | 95 bool JavascriptMessageBoxHandler::Cancel() { |
| 96 // We need to do this before WM_DESTROY (WindowClosing()) as any parent frame | 96 // We need to do this before WM_DESTROY (WindowClosing()) as any parent frame |
| 97 // will receive it's activation messages before this dialog receives | 97 // will receive it's activation messages before this dialog receives |
| 98 // WM_DESTROY. The parent frame would then try to activate any modal dialogs | 98 // WM_DESTROY. The parent frame would then try to activate any modal dialogs |
| 99 // that were still open in the ModalDialogQueue, which would send activation | 99 // that were still open in the ModalDialogQueue, which would send activation |
| 100 // back to this one. The framework should be improved to handle this, so this | 100 // back to this one. The framework should be improved to handle this, so this |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // Make sure we get navigation notifications so we know when our parent | 205 // Make sure we get navigation notifications so we know when our parent |
| 206 // contents will disappear or navigate to a different page. | 206 // contents will disappear or navigate to a different page. |
| 207 NotificationService::current()-> | 207 NotificationService::current()-> |
| 208 AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED, | 208 AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED, |
| 209 NotificationService::AllSources()); | 209 NotificationService::AllSources()); |
| 210 NotificationService::current()-> | 210 NotificationService::current()-> |
| 211 AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED, | 211 AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED, |
| 212 NotificationService::AllSources()); | 212 NotificationService::AllSources()); |
| 213 } | 213 } |
| 214 | 214 |
| OLD | NEW |