diff options
25 files changed, 576 insertions, 501 deletions
diff --git a/chrome/browser/app_modal_dialog.cc b/chrome/browser/app_modal_dialog.cc new file mode 100644 index 0000000..91cffdd --- /dev/null +++ b/chrome/browser/app_modal_dialog.cc @@ -0,0 +1,99 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/app_modal_dialog.h" + +#include "chrome/browser/app_modal_dialog_queue.h" +#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/common/notification_service.h" +#include "chrome/common/notification_type.h" +#include "chrome/common/ipc_message.h" + +AppModalDialog::AppModalDialog(WebContents* web_contents, + const std::wstring& title, + int dialog_flags, + const std::wstring& message_text, + const std::wstring& default_prompt_text, + bool display_suppress_checkbox, + bool is_before_unload_dialog, + IPC::Message* reply_msg) + : web_contents_(web_contents), + title_(title), + dialog_flags_(dialog_flags), + message_text_(message_text), + default_prompt_text_(default_prompt_text), + display_suppress_checkbox_(display_suppress_checkbox), + is_before_unload_dialog_(is_before_unload_dialog), + reply_msg_(reply_msg) { + InitNotifications(); +} + +void AppModalDialog::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + if (!web_contents_) + return; + + if (type == NotificationType::NAV_ENTRY_COMMITTED && + Source<NavigationController>(source).ptr() == web_contents_->controller()) + web_contents_ = NULL; + + if (type == NotificationType::TAB_CONTENTS_DESTROYED && + Source<TabContents>(source).ptr() == + static_cast<TabContents*>(web_contents_)) + web_contents_ = NULL; + + if (!web_contents_) + CloseModalDialog(); +} + +void AppModalDialog::InitNotifications() { + // Make sure we get navigation notifications so we know when our parent + // contents will disappear or navigate to a different page. + registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + NotificationService::AllSources()); + registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + NotificationService::AllSources()); +} + +void AppModalDialog::ShowModalDialog() { + // If the WebContents that created this dialog navigated away before this + // dialog became visible, simply show the next dialog if any. + if (!web_contents_) { + AppModalDialogQueue::ShowNextDialog(); + delete this; + return; + } + + web_contents_->Activate(); + CreateAndShowDialog(); +} + +void AppModalDialog::OnCancel() { + // We need to do this before WM_DESTROY (WindowClosing()) as any parent frame + // will receive it's activation messages before this dialog receives + // WM_DESTROY. The parent frame would then try to activate any modal dialogs + // that were still open in the ModalDialogQueue, which would send activation + // back to this one. The framework should be improved to handle this, so this + // is a temporary workaround. + AppModalDialogQueue::ShowNextDialog(); + + if (web_contents_) { + web_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, false, + std::wstring()); + } +} + +void AppModalDialog::OnAccept(const std::wstring& prompt_text, + bool suppress_js_messages) { + AppModalDialogQueue::ShowNextDialog(); + + if (web_contents_) { + web_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, true, + prompt_text); + + if (suppress_js_messages) + web_contents()->set_suppress_javascript_messages(true); + } +} diff --git a/chrome/browser/app_modal_dialog.h b/chrome/browser/app_modal_dialog.h new file mode 100644 index 0000000..2f09a7e --- /dev/null +++ b/chrome/browser/app_modal_dialog.h @@ -0,0 +1,109 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_APP_MODAL_DIALOG_H_ +#define CHROME_BROWSER_APP_MODAL_DIALOG_H_ + +#include <string> + +#include "build/build_config.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" + +#if defined(OS_WIN) +class JavascriptMessageBoxDialog; +typedef JavascriptMessageBoxDialog* NativeDialog; +#elif defined(OS_LINUX) +typedef void* NativeDialog; +#elif defined(OS_MACOSX) +typedef void* NativeDialog; +#endif + +class WebContents; +namespace IPC { +class Message; +} + +// A controller+model class for javascript alert, confirm, prompt, and +// onbeforeunload dialog boxes. |NativeDialog| is a platform specific +// view. +class AppModalDialog : public NotificationObserver { + public: + // A union of data necessary to determine the type of message box to + // show. |dialog_flags| is a MessageBox flag. + AppModalDialog(WebContents* web_contents, + const std::wstring& title, + int dialog_flags, + const std::wstring& message_text, + const std::wstring& default_prompt_text, + bool display_suppress_checkbox, + bool is_before_unload_dialog, + IPC::Message* reply_msg); + ~AppModalDialog(); + + // Called by the app modal window queue when it is time to show this window. + void ShowModalDialog(); + + ///////////////////////////////////////////////////////////////////////////// + // The following methods are platform specific and should be implemented in + // the platform specific .cc files. + // Create the platform specific NativeDialog and display it. + void CreateAndShowDialog(); + + // Close the dialog if it is showing. + void CloseModalDialog(); + + // Called by the app modal window queue to activate the window. + void ActivateModalDialog(); + + ///////////////////////////////////////////////////////////////////////////// + // Getters so NativeDialog can get information about the message box. + WebContents* web_contents() { + return web_contents_; + } + int dialog_flags() { + return dialog_flags_; + } + std::wstring title() { + return title_; + } + bool is_before_unload_dialog() { + return is_before_unload_dialog_; + } + + // Callbacks from NativeDialog when the user accepts or cancels the dialog. + void OnCancel(); + void OnAccept(const std::wstring& prompt_text, bool suppress_js_messages); + + // Helper methods used to query or control the dialog. This is used by + // automation. + int GetDialogButtons(); + void AcceptWindow(); + void CancelWindow(); + + private: + void InitNotifications(); + + // NotificationObserver implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + NotificationRegistrar registrar_; + + // A reference to the platform native dialog box. + NativeDialog dialog_; + + // Information about the message box is held in the following variables. + WebContents* web_contents_; + std::wstring title_; + int dialog_flags_; + std::wstring message_text_; + std::wstring default_prompt_text_; + bool display_suppress_checkbox_; + bool is_before_unload_dialog_; + IPC::Message* reply_msg_; +}; + +#endif // #ifndef CHROME_BROWSER_APP_MODAL_DIALOG_H_ diff --git a/chrome/browser/app_modal_dialog_queue.cc b/chrome/browser/app_modal_dialog_queue.cc index c3888bd..e24a7b0 100644 --- a/chrome/browser/app_modal_dialog_queue.cc +++ b/chrome/browser/app_modal_dialog_queue.cc @@ -7,15 +7,14 @@ #include "chrome/browser/browser_list.h" // static -std::queue<views::AppModalDialogDelegate*>* +std::queue<AppModalDialog*>* AppModalDialogQueue::app_modal_dialog_queue_ = NULL; -views::AppModalDialogDelegate* AppModalDialogQueue::active_dialog_ = NULL; +AppModalDialog* AppModalDialogQueue::active_dialog_ = NULL; // static -void AppModalDialogQueue::AddDialog(views::AppModalDialogDelegate* dialog) { - DCHECK(dialog->IsModal()); +void AppModalDialogQueue::AddDialog(AppModalDialog* dialog) { if (!app_modal_dialog_queue_) { - app_modal_dialog_queue_ = new std::queue<views::AppModalDialogDelegate*>; + app_modal_dialog_queue_ = new std::queue<AppModalDialog*>; ShowModalDialog(dialog); } @@ -44,8 +43,7 @@ void AppModalDialogQueue::ActivateModalDialog() { } // static -void AppModalDialogQueue::ShowModalDialog( - views::AppModalDialogDelegate* dialog) { +void AppModalDialogQueue::ShowModalDialog(AppModalDialog* dialog) { // ShowModalDialog can wind up calling ShowNextDialog in some cases, // which will wind up calling this method recursively, so active_dialog_ // must be set first. diff --git a/chrome/browser/app_modal_dialog_queue.h b/chrome/browser/app_modal_dialog_queue.h index 2482d5a..bfe755c 100644 --- a/chrome/browser/app_modal_dialog_queue.h +++ b/chrome/browser/app_modal_dialog_queue.h @@ -7,9 +7,9 @@ #include <queue> -#include "chrome/views/window/app_modal_dialog_delegate.h" +#include "chrome/browser/app_modal_dialog.h" -// Keeps a queue of AppModalDialogDelegates, making sure only one app modal +// Keeps a queue of AppModalDialogs, making sure only one app modal // dialog is shown at a time. class AppModalDialogQueue { public: @@ -21,9 +21,9 @@ class AppModalDialogQueue { // assure it is the child of BrowserList::GetLastActive() so that it is // activated as well. See browser_list.h for more notes about our somewhat // sloppy app modality. - // Note: The AppModalDialogDelegate |dialog| must be window modal before it + // Note: The AppModalDialog |dialog| must be window modal before it // can be added as app modal. - static void AddDialog(views::AppModalDialogDelegate* dialog); + static void AddDialog(AppModalDialog* dialog); // Removes the current dialog in the queue (the one that is being shown). // Shows the next dialog in the queue, if any is present. This does not @@ -45,22 +45,21 @@ class AppModalDialogQueue { } // Accessor for |active_dialog_|. - static views::AppModalDialogDelegate* active_dialog() { + static AppModalDialog* active_dialog() { return active_dialog_; } private: // Shows |dialog| and notifies the BrowserList that a modal dialog is showing. - static void ShowModalDialog(views::AppModalDialogDelegate* dialog); + static void ShowModalDialog(AppModalDialog* dialog); // Contains all app modal dialogs which are waiting to be shown, with the // currently modal dialog at the front of the queue. - static std::queue<views::AppModalDialogDelegate*>* - app_modal_dialog_queue_; + static std::queue<AppModalDialog*>* app_modal_dialog_queue_; // The currently active app-modal dialog box's delegate. NULL if there is no // active app-modal dialog box. - static views::AppModalDialogDelegate* active_dialog_; + static AppModalDialog* active_dialog_; }; #endif // CHROME_BROWSER_APP_MODAL_DIALOG_QUEUE_H__ diff --git a/chrome/browser/app_modal_dialog_win.cc b/chrome/browser/app_modal_dialog_win.cc new file mode 100644 index 0000000..ab01474 --- /dev/null +++ b/chrome/browser/app_modal_dialog_win.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/app_modal_dialog.h" + +#include "base/logging.h" +#include "chrome/browser/views/jsmessage_box_dialog.h" +#include "chrome/views/window/window.h" + +AppModalDialog::~AppModalDialog() { +} + +void AppModalDialog::CreateAndShowDialog() { + dialog_ = new JavascriptMessageBoxDialog(this, message_text_, + default_prompt_text_, display_suppress_checkbox_); + DCHECK(dialog_->IsModal()); + dialog_->ShowModalDialog(); +} + +void AppModalDialog::ActivateModalDialog() { + dialog_->ActivateModalDialog(); +} + +void AppModalDialog::CloseModalDialog() { + dialog_->CloseModalDialog(); +} + +int AppModalDialog::GetDialogButtons() { + return dialog_->GetDialogButtons(); +} + +void AppModalDialog::AcceptWindow() { + views::DialogClientView* client_view = + dialog_->window()->GetClientView()->AsDialogClientView(); + client_view->AcceptWindow(); +} + +void AppModalDialog::CancelWindow() { + views::DialogClientView* client_view = + dialog_->window()->GetClientView()->AsDialogClientView(); + client_view->CancelWindow(); +} diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 37e7b7e..2d73a9c 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -9,6 +9,7 @@ #include "base/string_util.h" #include "base/thread.h" #include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/app_modal_dialog.h" #include "chrome/browser/automation/automation_provider_list.h" #include "chrome/browser/automation/url_request_failed_dns_job.h" #include "chrome/browser/automation/url_request_mock_http_job.h" @@ -43,7 +44,7 @@ #include "chrome/browser/printing/print_job.h" #include "chrome/browser/views/bookmark_bar_view.h" #include "chrome/browser/views/location_bar_view.h" -#include "chrome/views/window/app_modal_dialog_delegate.h" +#include "chrome/views/window/dialog_delegate.h" #include "chrome/views/window/window.h" #endif // defined(OS_WIN) @@ -1227,8 +1228,7 @@ void AutomationProvider::GetBrowserWindowCount(int* window_count) { // TODO(port): Enable when dialog delegate is ported. void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, int* dialog_button) { - views::AppModalDialogDelegate* dialog_delegate = - AppModalDialogQueue::active_dialog(); + AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog(); *showing_dialog = (dialog_delegate != NULL); if (*showing_dialog) *dialog_button = dialog_delegate->GetDialogButtons(); @@ -1239,21 +1239,18 @@ void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) { *success = false; - views::AppModalDialogDelegate* dialog_delegate = - AppModalDialogQueue::active_dialog(); + AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog(); if (dialog_delegate && (dialog_delegate->GetDialogButtons() & button) == button) { - views::DialogClientView* client_view = - dialog_delegate->window()->GetClientView()->AsDialogClientView(); if ((button & views::DialogDelegate::DIALOGBUTTON_OK) == views::DialogDelegate::DIALOGBUTTON_OK) { - client_view->AcceptWindow(); + dialog_delegate->AcceptWindow(); *success = true; } if ((button & views::DialogDelegate::DIALOGBUTTON_CANCEL) == views::DialogDelegate::DIALOGBUTTON_CANCEL) { DCHECK(!*success) << "invalid param, OK and CANCEL specified"; - client_view->CancelWindow(); + dialog_delegate->CancelWindow(); *success = true; } } diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 8a876db..08401f2 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -642,6 +642,18 @@ Name="Browser Window" > <File + RelativePath=".\app_modal_dialog.cc" + > + </File> + <File + RelativePath=".\app_modal_dialog.h" + > + </File> + <File + RelativePath=".\app_modal_dialog_win.cc" + > + </File> + <File RelativePath=".\app_modal_dialog_queue.cc" > </File> @@ -718,15 +730,7 @@ > </File> <File - RelativePath=".\js_before_unload_handler.h" - > - </File> - <File - RelativePath=".\js_before_unload_handler_win.cc" - > - </File> - <File - RelativePath=".\js_before_unload_handler_win.h" + RelativePath=".\jsmessage_box_handler.cc" > </File> <File @@ -734,14 +738,6 @@ > </File> <File - RelativePath=".\jsmessage_box_handler_win.cc" - > - </File> - <File - RelativePath=".\jsmessage_box_handler_win.h" - > - </File> - <File RelativePath=".\load_from_memory_cache_details.h" > </File> diff --git a/chrome/browser/js_before_unload_handler.h b/chrome/browser/js_before_unload_handler.h deleted file mode 100644 index bdec058..0000000 --- a/chrome/browser/js_before_unload_handler.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_JS_BEFORE_UNLOAD_HANDLER_H_ -#define CHROME_BROWSER_JS_BEFORE_UNLOAD_HANDLER_H_ - -// This will display a modal dialog box with a header and footer asking the -// the user if they wish to navigate away from a page, with additional text -// |message_text| between the header and footer. The users response is -// returned to the renderer using |reply_msg|. -void RunBeforeUnloadDialog(WebContents* web_contents, - const GURL& frame_url, - const std::wstring& message_text, - IPC::Message* reply_msg); - -#endif // CHROME_BROWSER_JS_BEFORE_UNLOAD_HANDLER_H_ diff --git a/chrome/browser/js_before_unload_handler_win.cc b/chrome/browser/js_before_unload_handler_win.cc deleted file mode 100644 index f97620d..0000000 --- a/chrome/browser/js_before_unload_handler_win.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/js_before_unload_handler_win.h" - -#include "chrome/browser/app_modal_dialog_queue.h" -#include "chrome/common/l10n_util.h" -#include "chrome/common/message_box_flags.h" -#include "grit/generated_resources.h" - -void RunBeforeUnloadDialog(WebContents* web_contents, - const GURL& frame_url, - const std::wstring& message_text, - IPC::Message* reply_msg) { - std::wstring full_message = - message_text + L"\n\n" + - l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); - JavascriptBeforeUnloadHandler* handler = - new JavascriptBeforeUnloadHandler(web_contents, frame_url, full_message, - reply_msg); - AppModalDialogQueue::AddDialog(handler); -} - -// JavascriptBeforeUnloadHandler ----------------------------------------------- - -JavascriptBeforeUnloadHandler::JavascriptBeforeUnloadHandler( - WebContents* web_contents, - const GURL& frame_url, - const std::wstring& message_text, - IPC::Message* reply_msg) - : JavascriptMessageBoxHandler(web_contents, - frame_url, - MessageBox::kIsJavascriptConfirm, - message_text, - std::wstring(), - false, - reply_msg) { -} - -std::wstring JavascriptBeforeUnloadHandler::GetWindowTitle() const { - return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE); -} - -std::wstring JavascriptBeforeUnloadHandler::GetDialogButtonLabel( - DialogButton button) const { - if (button == DialogDelegate::DIALOGBUTTON_OK) { - return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); - } else if (button == DialogDelegate::DIALOGBUTTON_CANCEL) { - return l10n_util::GetString( - IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); - } - return L""; -} diff --git a/chrome/browser/js_before_unload_handler_win.h b/chrome/browser/js_before_unload_handler_win.h deleted file mode 100644 index 7b3d9d8..0000000 --- a/chrome/browser/js_before_unload_handler_win.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_JS_BEFORE_UNLOAD_HANDLER_WIN_H_ -#define CHROME_BROWSER_JS_BEFORE_UNLOAD_HANDLER_WIN_H_ - -#include "chrome/browser/jsmessage_box_handler_win.h" - -class WebContents; - -class JavascriptBeforeUnloadHandler : public JavascriptMessageBoxHandler { - public: - // Cross-platform code should use RunBeforeUnloadDialog. - JavascriptBeforeUnloadHandler(WebContents* web_contents, - const GURL& frame_url, - const std::wstring& message_text, - IPC::Message* reply_msg); - virtual ~JavascriptBeforeUnloadHandler() {} - - // views::DialogDelegate Methods: - virtual std::wstring GetWindowTitle() const; - virtual std::wstring GetDialogButtonLabel(DialogButton button) const; - - private: - DISALLOW_COPY_AND_ASSIGN(JavascriptBeforeUnloadHandler); -}; - -#endif // CHROME_BROWSER_JS_BEFORE_UNLOAD_HANDLER_WIN_H_ diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc new file mode 100644 index 0000000..426d10b --- /dev/null +++ b/chrome/browser/jsmessage_box_handler.cc @@ -0,0 +1,79 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/jsmessage_box_handler.h" + +#include "build/build_config.h" +#include "chrome/browser/app_modal_dialog_queue.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/common/gfx/text_elider.h" +#include "chrome/common/l10n_util.h" +#include "chrome/common/message_box_flags.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" +#include "googleurl/src/gurl.h" +#include "grit/generated_resources.h" + +namespace { + +std::wstring GetWindowTitle(WebContents* web_contents, const GURL& frame_url) { + if (!frame_url.has_host()) + return l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); + + // We really only want the scheme, hostname, and port. + GURL::Replacements replacements; + replacements.ClearUsername(); + replacements.ClearPassword(); + replacements.ClearPath(); + replacements.ClearQuery(); + replacements.ClearRef(); + GURL clean_url = frame_url.ReplaceComponents(replacements); + + // TODO(brettw) it should be easier than this to do the correct language + // handling without getting the accept language from the profile. + std::wstring base_address = gfx::ElideUrl(clean_url, ChromeFont(), 0, + web_contents->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); + // Force URL to have LTR directionality. + if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) + l10n_util::WrapStringWithLTRFormatting(&base_address); + return l10n_util::GetStringF(IDS_JAVASCRIPT_MESSAGEBOX_TITLE, base_address); +} + +} + +void RunJavascriptMessageBox(WebContents* web_contents, + const GURL& frame_url, + int dialog_flags, + const std::wstring& message_text, + const std::wstring& default_prompt_text, + bool display_suppress_checkbox, + IPC::Message* reply_msg) { + std::wstring title = GetWindowTitle(web_contents, frame_url); + +#if defined(OS_WIN) + AppModalDialogQueue::AddDialog(new AppModalDialog(web_contents, title, + dialog_flags, message_text, default_prompt_text, + display_suppress_checkbox, false, reply_msg)); +#else + NOTIMPLEMENTED(); +#endif +} + +void RunBeforeUnloadDialog(WebContents* web_contents, + const std::wstring& message_text, + IPC::Message* reply_msg) { + std::wstring full_message = + message_text + L"\n\n" + + l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); +#if defined(OS_WIN) + AppModalDialogQueue::AddDialog(new AppModalDialog( + web_contents, l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE), + MessageBox::kIsJavascriptConfirm, message_text, std::wstring(), false, + true, reply_msg)); +#else + NOTIMPLEMENTED(); +#endif +} diff --git a/chrome/browser/jsmessage_box_handler.h b/chrome/browser/jsmessage_box_handler.h index 149bfd7..86e7b70 100644 --- a/chrome/browser/jsmessage_box_handler.h +++ b/chrome/browser/jsmessage_box_handler.h @@ -26,4 +26,12 @@ void RunJavascriptMessageBox(WebContents* web_contents, bool display_suppress_checkbox, IPC::Message* reply_msg); +// This will display a modal dialog box with a header and footer asking the +// the user if they wish to navigate away from a page, with additional text +// |message_text| between the header and footer. The users response is +// returned to the renderer using |reply_msg|. +void RunBeforeUnloadDialog(WebContents* web_contents, + const std::wstring& message_text, + IPC::Message* reply_msg); + #endif // CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_H_ diff --git a/chrome/browser/jsmessage_box_handler_win.cc b/chrome/browser/jsmessage_box_handler_win.cc deleted file mode 100644 index 5184dd6..0000000 --- a/chrome/browser/jsmessage_box_handler_win.cc +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/jsmessage_box_handler_win.h" - -#include "base/string_util.h" -#include "chrome/browser/app_modal_dialog_queue.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/web_contents.h" -#include "chrome/common/gfx/text_elider.h" -#include "chrome/common/l10n_util.h" -#include "chrome/common/message_box_flags.h" -#include "chrome/common/notification_service.h" -#include "chrome/common/notification_type.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/pref_service.h" -#include "chrome/views/controls/message_box_view.h" -#include "chrome/views/window/window.h" -#include "grit/generated_resources.h" - -void RunJavascriptMessageBox(WebContents* web_contents, - const GURL& frame_url, - int dialog_flags, - const std::wstring& message_text, - const std::wstring& default_prompt_text, - bool display_suppress_checkbox, - IPC::Message* reply_msg) { - JavascriptMessageBoxHandler* handler = - new JavascriptMessageBoxHandler(web_contents, frame_url, dialog_flags, - message_text, default_prompt_text, - display_suppress_checkbox, reply_msg); - AppModalDialogQueue::AddDialog(handler); -} - -JavascriptMessageBoxHandler::JavascriptMessageBoxHandler( - WebContents* web_contents, - const GURL& frame_url, - int dialog_flags, - const std::wstring& message_text, - const std::wstring& default_prompt_text, - bool display_suppress_checkbox, - IPC::Message* reply_msg) - : web_contents_(web_contents), - frame_url_(frame_url), - reply_msg_(reply_msg), - dialog_flags_(dialog_flags), - dialog_(NULL), - message_box_view_(new MessageBoxView( - dialog_flags | MessageBox::kAutoDetectAlignment, - message_text, default_prompt_text)) { - DCHECK(message_box_view_); - DCHECK(reply_msg_); - - if (display_suppress_checkbox) { - message_box_view_->SetCheckBoxLabel( - l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); - } - - // Make sure we get navigation notifications so we know when our parent - // contents will disappear or navigate to a different page. - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, - NotificationService::AllSources()); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, - NotificationService::AllSources()); -} - -JavascriptMessageBoxHandler::~JavascriptMessageBoxHandler() { -} - -////////////////////////////////////////////////////////////////////////////// -// JavascriptMessageBoxHandler, views::DialogDelegate implementation: - -int JavascriptMessageBoxHandler::GetDialogButtons() const { - int dialog_buttons = 0; - if (dialog_flags_ & MessageBox::kFlagHasOKButton) - dialog_buttons = DIALOGBUTTON_OK; - - if (dialog_flags_ & MessageBox::kFlagHasCancelButton) - dialog_buttons |= DIALOGBUTTON_CANCEL; - - return dialog_buttons; -} - -std::wstring JavascriptMessageBoxHandler::GetWindowTitle() const { - if (!frame_url_.has_host() || !web_contents_) - return l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); - - // We really only want the scheme, hostname, and port. - GURL::Replacements replacements; - replacements.ClearUsername(); - replacements.ClearPassword(); - replacements.ClearPath(); - replacements.ClearQuery(); - replacements.ClearRef(); - GURL clean_url = frame_url_.ReplaceComponents(replacements); - - // TODO(brettw) it should be easier than this to do the correct language - // handling without getting the accept language from the profile. - std::wstring base_address = gfx::ElideUrl(clean_url, ChromeFont(), 0, - web_contents_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); - // Force URL to have LTR directionality. - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) - l10n_util::WrapStringWithLTRFormatting(&base_address); - return l10n_util::GetStringF(IDS_JAVASCRIPT_MESSAGEBOX_TITLE, base_address); -} - -void JavascriptMessageBoxHandler::WindowClosing() { - dialog_ = NULL; - - if (message_box_view_->IsCheckBoxSelected() && web_contents_) - web_contents_->set_suppress_javascript_messages(true); -} - -void JavascriptMessageBoxHandler::DeleteDelegate() { - delete this; -} - -bool JavascriptMessageBoxHandler::Cancel() { - // We need to do this before WM_DESTROY (WindowClosing()) as any parent frame - // will receive it's activation messages before this dialog receives - // WM_DESTROY. The parent frame would then try to activate any modal dialogs - // that were still open in the ModalDialogQueue, which would send activation - // back to this one. The framework should be improved to handle this, so this - // is a temporary workaround. - AppModalDialogQueue::ShowNextDialog(); - - if (web_contents_) { - web_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, false, - EmptyWString()); - } - return true; -} - -bool JavascriptMessageBoxHandler::Accept() { - AppModalDialogQueue::ShowNextDialog(); - - if (web_contents_) { - web_contents_->OnJavaScriptMessageBoxClosed( - reply_msg_, true, message_box_view_->GetInputText()); - } - return true; -} - -////////////////////////////////////////////////////////////////////////////// -// JavascriptMessageBoxHandler, views::AppModalDialogDelegate -// implementation: - -void JavascriptMessageBoxHandler::ShowModalDialog() { - // If the WebContents that created this dialog navigated away before this - // dialog became visible, simply show the next dialog if any. - if (!web_contents_) { - AppModalDialogQueue::ShowNextDialog(); - delete this; - return; - } - - web_contents_->Activate(); - HWND root_hwnd = GetAncestor(web_contents_->GetNativeView(), GA_ROOT); - dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this); - dialog_->Show(); -} - -void JavascriptMessageBoxHandler::ActivateModalDialog() { - // Ensure that the dialog is visible and at the top of the z-order. These - // conditions may not be true if the dialog was opened on a different virtual - // desktop to the one the browser window is on. - dialog_->Show(); - dialog_->Activate(); -} - -/////////////////////////////////////////////////////////////////////////////// -// JavascriptMessageBoxHandler, views::WindowDelegate implementation: - -views::View* JavascriptMessageBoxHandler::GetContentsView() { - return message_box_view_; -} - -views::View* JavascriptMessageBoxHandler::GetInitiallyFocusedView() { - if (message_box_view_->text_box()) - return message_box_view_->text_box(); - return views::AppModalDialogDelegate::GetInitiallyFocusedView(); -} - -/////////////////////////////////////////////////////////////////////////////// -// JavascriptMessageBoxHandler, private: - -void JavascriptMessageBoxHandler::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - if (!web_contents_) - return; - - bool web_contents_gone = false; - - if (type == NotificationType::NAV_ENTRY_COMMITTED && - Source<NavigationController>(source).ptr() == web_contents_->controller()) - web_contents_gone = true; - - if (type == NotificationType::TAB_CONTENTS_DESTROYED && - Source<TabContents>(source).ptr() == - static_cast<TabContents*>(web_contents_)) - web_contents_gone = true; - - if (web_contents_gone) { - web_contents_ = NULL; - - // If the dialog is visible close it. - if (dialog_) - dialog_->Close(); - } -} diff --git a/chrome/browser/jsmessage_box_handler_win.h b/chrome/browser/jsmessage_box_handler_win.h deleted file mode 100644 index ff2b152..0000000 --- a/chrome/browser/jsmessage_box_handler_win.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ -#define CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ - -#include "chrome/browser/jsmessage_box_handler.h" -#include "chrome/common/ipc_message.h" -#include "chrome/common/notification_observer.h" -#include "chrome/common/notification_registrar.h" -#include "chrome/views/window/app_modal_dialog_delegate.h" -#include "googleurl/src/gurl.h" - -class MessageBoxView; -class WebContents; -namespace views { -class Window; -} - -class JavascriptMessageBoxHandler - : public views::AppModalDialogDelegate, - public NotificationObserver { - public: - // Cross-platform code should use RunJavaScriptMessageBox. - JavascriptMessageBoxHandler(WebContents* web_contents, - const GURL& frame_url, - int dialog_flags, - const std::wstring& message_text, - const std::wstring& default_prompt_text, - bool display_suppress_checkbox, - IPC::Message* reply_msg); - virtual ~JavascriptMessageBoxHandler(); - - // views::DialogDelegate Methods: - virtual int GetDialogButtons() const; - virtual std::wstring GetWindowTitle() const; - virtual void WindowClosing(); - virtual void DeleteDelegate(); - virtual bool Cancel(); - virtual bool Accept(); - - // views::AppModalDialogDelegate - virtual void ShowModalDialog(); - virtual void ActivateModalDialog(); - - // views::WindowDelegate Methods: - virtual bool IsModal() const { return true; } - virtual views::View* GetContentsView(); - virtual views::View* GetInitiallyFocusedView(); - - private: - // NotificationObserver implementation. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - NotificationRegistrar registrar_; - - // The message box view whose commands we handle. - MessageBoxView* message_box_view_; - - // The IPC message used to reply to the renderer when the message box - // is dismissed. - IPC::Message* reply_msg_; - - // The associated WebContents. Used to send IPC messages to the renderer. - WebContents* web_contents_; - - // The URL of the frame originating the dialog. It is important we display - // this so the user doesn't blame the enclosing site if a subframe alert()s. - GURL frame_url_; - - // Stores flags defined in message_box_view.h which describe the dialog box. - int dialog_flags_; - - // The dialog if it is currently visible. - views::Window* dialog_; - - DISALLOW_COPY_AND_ASSIGN(JavascriptMessageBoxHandler); -}; - -#endif // CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index e049523..fa009e2 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -1149,7 +1149,7 @@ void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, StopHangMonitorTimeout(); if (modal_dialog_count_++ == 0) modal_dialog_event_->Signal(); - delegate_->RunBeforeUnloadConfirm(frame_url, message, reply_msg); + delegate_->RunBeforeUnloadConfirm(message, reply_msg); } void RenderViewHost::OnMsgShowModalHTMLDialog( diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index 63c01e6..7a9a94b 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -295,8 +295,7 @@ class RenderViewHostDelegate { IPC::Message* reply_msg, bool* did_suppress_message) { } - virtual void RunBeforeUnloadConfirm(const GURL& frame_url, - const std::wstring& message, + virtual void RunBeforeUnloadConfirm(const std::wstring& message, IPC::Message* reply_msg) { } // Display this RenderViewHost in a modal fashion. diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index ee734d4..9cd5550 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -20,7 +20,6 @@ #include "chrome/browser/download/download_manager.h" #include "chrome/browser/gears_integration.h" #include "chrome/browser/google_util.h" -#include "chrome/browser/js_before_unload_handler.h" #include "chrome/browser/jsmessage_box_handler.h" #include "chrome/browser/load_from_memory_cache_details.h" #include "chrome/browser/load_notification_details.h" @@ -1194,10 +1193,9 @@ void WebContents::RunJavaScriptMessage( } } -void WebContents::RunBeforeUnloadConfirm(const GURL& frame_url, - const std::wstring& message, +void WebContents::RunBeforeUnloadConfirm(const std::wstring& message, IPC::Message* reply_msg) { - RunBeforeUnloadDialog(this, frame_url, message, reply_msg); + RunBeforeUnloadDialog(this, message, reply_msg); } void WebContents::ShowModalHTMLDialog(const GURL& url, int width, int height, diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index 07e0db3..be0fe27 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -236,7 +236,7 @@ class WebContents : public TabContents, suppress_javascript_messages_ = suppress_javascript_messages; } - // JavascriptMessageBoxHandler calls this when the dialog is closed. + // AppModalDialog calls this when the dialog is closed. void OnJavaScriptMessageBoxClosed(IPC::Message* reply_msg, bool success, const std::wstring& prompt); @@ -378,8 +378,7 @@ class WebContents : public TabContents, const int flags, IPC::Message* reply_msg, bool* did_suppress_message); - virtual void RunBeforeUnloadConfirm(const GURL& frame_url, - const std::wstring& message, + virtual void RunBeforeUnloadConfirm(const std::wstring& message, IPC::Message* reply_msg); virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, const std::string& json_arguments, diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj index 9cde61c..0e433e9 100644 --- a/chrome/browser/views/browser_views.vcproj +++ b/chrome/browser/views/browser_views.vcproj @@ -634,6 +634,14 @@ > </File> <File + RelativePath=".\jsmessage_box_dialog.cc" + > + </File> + <File + RelativePath=".\jsmessage_box_dialog.h" + > + </File> + <File RelativePath=".\keyword_editor_view.cc" > </File> diff --git a/chrome/browser/views/jsmessage_box_dialog.cc b/chrome/browser/views/jsmessage_box_dialog.cc new file mode 100644 index 0000000..bd0c7f2 --- /dev/null +++ b/chrome/browser/views/jsmessage_box_dialog.cc @@ -0,0 +1,122 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/views/jsmessage_box_dialog.h" + +#include "chrome/browser/app_modal_dialog.h" +#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/common/l10n_util.h" +#include "chrome/common/message_box_flags.h" +#include "chrome/views/controls/message_box_view.h" +#include "chrome/views/window/window.h" +#include "grit/generated_resources.h" + +JavascriptMessageBoxDialog::JavascriptMessageBoxDialog( + AppModalDialog* parent, + const std::wstring& message_text, + const std::wstring& default_prompt_text, + bool display_suppress_checkbox) + : parent_(parent), + dialog_(NULL), + message_box_view_(new MessageBoxView( + parent->dialog_flags() | MessageBox::kAutoDetectAlignment, + message_text, default_prompt_text)) { + DCHECK(message_box_view_); + + if (display_suppress_checkbox) { + message_box_view_->SetCheckBoxLabel( + l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); + } +} + +JavascriptMessageBoxDialog::~JavascriptMessageBoxDialog() { +} + +void JavascriptMessageBoxDialog::ShowModalDialog() { + HWND root_hwnd = GetAncestor(web_contents()->GetNativeView(), + GA_ROOT); + dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this); + dialog_->Show(); +} + +void JavascriptMessageBoxDialog::ActivateModalDialog() { + // Ensure that the dialog is visible and at the top of the z-order. These + // conditions may not be true if the dialog was opened on a different virtual + // desktop to the one the browser window is on. + dialog_->Show(); + dialog_->Activate(); +} + +void JavascriptMessageBoxDialog::CloseModalDialog() { + // If the dialog is visible close it. + if (dialog_) + dialog_->Close(); +} + +////////////////////////////////////////////////////////////////////////////// +// JavascriptMessageBoxDialog, views::DialogDelegate implementation: + +int JavascriptMessageBoxDialog::GetDialogButtons() const { + int dialog_buttons = 0; + if (parent_->dialog_flags() & MessageBox::kFlagHasOKButton) + dialog_buttons = DIALOGBUTTON_OK; + + if (parent_->dialog_flags() & MessageBox::kFlagHasCancelButton) + dialog_buttons |= DIALOGBUTTON_CANCEL; + + return dialog_buttons; +} + +std::wstring JavascriptMessageBoxDialog::GetWindowTitle() const { + return parent_->title();; +} + + +void JavascriptMessageBoxDialog::WindowClosing() { + dialog_ = NULL; + +} + +void JavascriptMessageBoxDialog::DeleteDelegate() { + delete parent_; + delete this; +} + +bool JavascriptMessageBoxDialog::Cancel() { + parent_->OnCancel(); + return true; +} + +bool JavascriptMessageBoxDialog::Accept() { + + parent_->OnAccept(message_box_view_->GetInputText(), + message_box_view_->IsCheckBoxSelected()); + return true; +} + +std::wstring JavascriptMessageBoxDialog::GetDialogButtonLabel( + DialogButton button) const { + if (parent_->is_before_unload_dialog()) { + if (button == DialogDelegate::DIALOGBUTTON_OK) { + return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); + } else if (button == DialogDelegate::DIALOGBUTTON_CANCEL) { + return l10n_util::GetString( + IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); + } + } + return DialogDelegate::GetDialogButtonLabel(button); +} + +/////////////////////////////////////////////////////////////////////////////// +// JavascriptMessageBoxDialog, views::WindowDelegate implementation: + +views::View* JavascriptMessageBoxDialog::GetContentsView() { + return message_box_view_; +} + +views::View* JavascriptMessageBoxDialog::GetInitiallyFocusedView() { + if (message_box_view_->text_box()) + return message_box_view_->text_box(); + return views::DialogDelegate::GetInitiallyFocusedView(); +} diff --git a/chrome/browser/views/jsmessage_box_dialog.h b/chrome/browser/views/jsmessage_box_dialog.h new file mode 100644 index 0000000..7195904 --- /dev/null +++ b/chrome/browser/views/jsmessage_box_dialog.h @@ -0,0 +1,64 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ +#define CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ + +#include <string> + +#include "chrome/browser/app_modal_dialog.h" +#include "chrome/views/window/dialog_delegate.h" + +class MessageBoxView; +class WebContents; +namespace views { +class Window; +} + +class JavascriptMessageBoxDialog : public views::DialogDelegate { + public: + JavascriptMessageBoxDialog(AppModalDialog* parent, + const std::wstring& message_text, + const std::wstring& default_prompt_text, + bool display_suppress_checkbox); + + virtual ~JavascriptMessageBoxDialog(); + + // Methods called from AppModalDialog. + void ShowModalDialog(); + void ActivateModalDialog(); + void CloseModalDialog(); + + // views::DialogDelegate Methods: + virtual int GetDialogButtons() const; + virtual std::wstring GetWindowTitle() const; + virtual void WindowClosing(); + virtual void DeleteDelegate(); + virtual bool Cancel(); + virtual bool Accept(); + virtual std::wstring GetDialogButtonLabel(DialogButton button) const; + + // views::WindowDelegate Methods: + virtual bool IsModal() const { return true; } + virtual views::View* GetContentsView(); + virtual views::View* GetInitiallyFocusedView(); + + private: + WebContents* web_contents() { + return parent_->web_contents(); + } + + // A pointer to the AppModalDialog that owns us. + AppModalDialog* parent_; + + // The message box view whose commands we handle. + MessageBoxView* message_box_view_; + + // The dialog if it is currently visible. + views::Window* dialog_; + + DISALLOW_COPY_AND_ASSIGN(JavascriptMessageBoxDialog); +}; + +#endif // CHROME_BROWSER_VIEWS_JSMESSAGE_BOX_DIALOG_H_ diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index ad067fe..eb4f0c0 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -382,6 +382,9 @@ 'browser/alternate_nav_url_fetcher.h', 'browser/app_controller_mac.h', 'browser/app_controller_mac.mm', + 'browser/app_modal_dialog.cc', + 'browser/app_modal_dialog.h', + 'browser/app_modal_dialog_win.cc', 'browser/app_modal_dialog_queue.cc', 'browser/app_modal_dialog_queue.h', 'browser/autocomplete/autocomplete.cc', @@ -792,12 +795,8 @@ 'browser/importer/mork_reader.h', 'browser/jankometer.cc', 'browser/jankometer.h', - 'browser/js_before_unload_handler.h', - 'browser/js_before_unload_handler_win.cc', - 'browser/js_before_unload_handler_win.h', + 'browser/jsmessage_box_handler.cc', 'browser/jsmessage_box_handler.h', - 'browser/jsmessage_box_handler_win.cc', - 'browser/jsmessage_box_handler_win.h', 'browser/load_from_memory_cache_details.h', 'browser/load_notification_details.h', 'browser/location_bar.h', @@ -1163,6 +1162,8 @@ 'browser/views/infobars/infobars.h', 'browser/views/input_window.cc', 'browser/views/input_window.h', + 'browser/views/jsmessage_box_dialog.cc', + 'browser/views/jsmessage_box_dialog.h', 'browser/views/keyword_editor_view.cc', 'browser/views/keyword_editor_view.h', 'browser/views/location_bar_view.cc', @@ -2612,7 +2613,6 @@ 'views/widget/widget_gtk.h', 'views/widget/widget_win.cc', 'views/widget/widget_win.h', - 'views/window/app_modal_dialog_delegate.h', 'views/window/client_view.cc', 'views/window/client_view.h', 'views/window/custom_frame_view.cc', diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index b5d1b34..73191cb 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -282,25 +282,6 @@ DownloadShelf* DownloadShelf::Create(TabContents* tab_contents) { //-------------------------------------------------------------------------- -void RunJavascriptMessageBox(WebContents* web_contents, - const GURL& url, - int dialog_flags, - const std::wstring& message_text, - const std::wstring& default_prompt_text, - bool display_suppress_checkbox, - IPC::Message* reply_msg) { - NOTIMPLEMENTED(); -} - -void RunBeforeUnloadDialog(WebContents* web_contents, - const GURL& url, - const std::wstring& message_text, - IPC::Message* reply_msg) { - NOTIMPLEMENTED(); -} - -//-------------------------------------------------------------------------- - void RunRepostFormWarningDialog(NavigationController*) { } diff --git a/chrome/views/views.vcproj b/chrome/views/views.vcproj index 52ca5af..0aba6df 100644 --- a/chrome/views/views.vcproj +++ b/chrome/views/views.vcproj @@ -335,10 +335,6 @@ Name="window" > <File - RelativePath=".\window\app_modal_dialog_delegate.h" - > - </File> - <File RelativePath=".\window\client_view.cc" > </File> diff --git a/chrome/views/window/app_modal_dialog_delegate.h b/chrome/views/window/app_modal_dialog_delegate.h deleted file mode 100644 index 6ccfc28..0000000 --- a/chrome/views/window/app_modal_dialog_delegate.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_VIEWS_WINDOW_APP_MODAL_DIALOG_DELEGATE_H_ -#define CHROME_VIEWS_WINDOW_APP_MODAL_DIALOG_DELEGATE_H_ - -#include "chrome/views/window/dialog_delegate.h" - -namespace views { - -// Pure virtual interface for a window which is app modal. -class AppModalDialogDelegate : public DialogDelegate { - public: - // Called by the app modal window queue when it is time to show this window. - virtual void ShowModalDialog() = 0; - - // Called by the app modal window queue to activate the window. - virtual void ActivateModalDialog() = 0; -}; - -} // namespace views - -#endif // #ifndef CHROME_VIEWS_WINDOW_APP_MODAL_DIALOG_DELEGATE_H_ |