diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 22:59:24 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 22:59:24 +0000 |
commit | a0c878693f22701d83e90ffdd610747ffc8b7111 (patch) | |
tree | ecb6e9b67b7745cf14a7574b331525346b5e638c /chrome | |
parent | 0bb17f3457fc494b9711ce6580571c1bc7dacf57 (diff) | |
download | chromium_src-a0c878693f22701d83e90ffdd610747ffc8b7111.zip chromium_src-a0c878693f22701d83e90ffdd610747ffc8b7111.tar.gz chromium_src-a0c878693f22701d83e90ffdd610747ffc8b7111.tar.bz2 |
Revert "Gtk confirm form resubmission dialog." Broke linux views build.
This reverts commit e6ab23c81e56c6b9fbb062bbb090a648e6ebef12.
TBR=beng
Review URL: http://codereview.chromium.org/183006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
20 files changed, 59 insertions, 179 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 3486a62..4acd94b 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2059,10 +2059,6 @@ void Browser::ShowPageInfo(Profile* profile, window()->ShowPageInfo(profile, url, ssl, show_history); } -void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { - window()->ShowRepostFormWarningDialog(tab_contents); -} - /////////////////////////////////////////////////////////////////////////////// // Browser, SelectFileDialog::Listener implementation: diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index d0f403a..63ccb0a 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -527,7 +527,6 @@ class Browser : public TabStripModelDelegate, const GURL& url, const NavigationEntry::SSLStatus& ssl, bool show_history); - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); // Overridden from SelectFileDialog::Listener: virtual void FileSelected(const FilePath& path, int index, void* params); diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index 2532d4b..a1dbe76 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -15,7 +15,6 @@ class FindBar; class GURL; class HtmlDialogUIDelegate; class LocationBar; -class NavigationController; class Profile; class StatusBubble; class TabContents; @@ -188,9 +187,6 @@ class BrowserWindow { // Shows the New Profile dialog box. virtual void ShowNewProfileDialog() = 0; - // Shows the repost form confirmation dialog box. - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) = 0; - // Shows the confirmation dialog box warning that the browser is closing with // in-progress downloads. // This method should call Browser::InProgressDownloadResponse once the user diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h index 0eb7693..1635602 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.h +++ b/chrome/browser/cocoa/browser_window_cocoa.h @@ -71,7 +71,6 @@ class BrowserWindowCocoa : public BrowserWindow, virtual void ShowPasswordManager(); virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); virtual void ConfirmBrowserCloseWithPendingDownloads(); virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, gfx::NativeWindow parent_window); diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index 7d8a202..13ff5bb 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -246,11 +246,6 @@ void BrowserWindowCocoa::ShowNewProfileDialog() { NOTIMPLEMENTED(); } -void BrowserWindowCocoa::ShowRepostFormWarningDialog( - TabContents* tab_contents) { - NOTIMPLEMENTED(); -} - // We allow closing the window here since the real quit decision on Mac is made // in [AppController quit:]. void BrowserWindowCocoa::ConfirmBrowserCloseWithPendingDownloads() { diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index d3df442..9c295ac 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -52,7 +52,6 @@ #include "chrome/browser/gtk/infobar_container_gtk.h" #include "chrome/browser/gtk/keyword_editor_view.h" #include "chrome/browser/gtk/nine_box.h" -#include "chrome/browser/gtk/repost_form_warning_gtk.h" #include "chrome/browser/gtk/status_bubble_gtk.h" #include "chrome/browser/gtk/tab_contents_container_gtk.h" #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" @@ -1025,11 +1024,6 @@ void BrowserWindowGtk::ShowNewProfileDialog() { NOTIMPLEMENTED(); } -void BrowserWindowGtk::ShowRepostFormWarningDialog( - TabContents* tab_contents) { - new RepostFormWarningGtk(GetNativeHandle(), &tab_contents->controller()); -} - void BrowserWindowGtk::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, gfx::NativeWindow parent_window) { NOTIMPLEMENTED(); diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h index c21a9ed..d186aa5 100644 --- a/chrome/browser/gtk/browser_window_gtk.h +++ b/chrome/browser/gtk/browser_window_gtk.h @@ -102,7 +102,6 @@ class BrowserWindowGtk : public BrowserWindow, virtual void ShowPasswordManager(); virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); virtual void ConfirmBrowserCloseWithPendingDownloads(); virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, gfx::NativeWindow parent_window); diff --git a/chrome/browser/gtk/repost_form_warning_gtk.cc b/chrome/browser/gtk/repost_form_warning_gtk.cc deleted file mode 100644 index fab88e6..0000000 --- a/chrome/browser/gtk/repost_form_warning_gtk.cc +++ /dev/null @@ -1,86 +0,0 @@ -// 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/gtk/repost_form_warning_gtk.h" - -#include "app/l10n_util.h" -#include "base/message_loop.h" -#include "chrome/browser/tab_contents/navigation_controller.h" -#include "chrome/common/gtk_util.h" -#include "chrome/common/notification_service.h" -#include "grit/generated_resources.h" - -RepostFormWarningGtk::RepostFormWarningGtk( - GtkWindow* parent, - NavigationController* navigation_controller) - : navigation_controller_(navigation_controller) { - dialog_ = gtk_message_dialog_new( - parent, - GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, - "%s", - l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING).c_str()); - gtk_window_set_title(GTK_WINDOW(dialog_), - l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING_TITLE).c_str()); - gtk_util::AddButtonToDialog(dialog_, - l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING_CANCEL).c_str(), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - gtk_util::AddButtonToDialog(dialog_, - l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING_RESEND).c_str(), - GTK_STOCK_REFRESH, GTK_RESPONSE_OK); - gtk_util::SetWindowIcon(GTK_WINDOW(dialog_)); - - g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this); - g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this); - - gtk_widget_show_all(dialog_); - - registrar_.Add(this, NotificationType::LOAD_START, - Source<NavigationController>(navigation_controller_)); - registrar_.Add(this, NotificationType::TAB_CLOSING, - Source<NavigationController>(navigation_controller_)); -} - -RepostFormWarningGtk::~RepostFormWarningGtk() { -} - -void RepostFormWarningGtk::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - // Close the dialog if we load a page (because reloading might not apply to - // the same page anymore) or if the tab is closed, because then we won't have - // a navigation controller anymore. - if (dialog_ && navigation_controller_ && - (type == NotificationType::LOAD_START || - type == NotificationType::TAB_CLOSING)) { - DCHECK_EQ(Source<NavigationController>(source).ptr(), - navigation_controller_); - navigation_controller_ = NULL; - Destroy(); - } -} - -void RepostFormWarningGtk::Destroy() { - if (dialog_) { - gtk_widget_destroy(dialog_); - dialog_ = NULL; - } -} - -// static -void RepostFormWarningGtk::OnResponse(GtkWidget* widget, int response, - RepostFormWarningGtk* dialog) { - dialog->Destroy(); - if (response == GTK_RESPONSE_OK) { - if (dialog->navigation_controller_) - dialog->navigation_controller_->Reload(false); - } -} - -// static -void RepostFormWarningGtk::OnWindowDestroy(GtkWidget* widget, - RepostFormWarningGtk* dialog) { - MessageLoop::current()->DeleteSoon(FROM_HERE, dialog); -} diff --git a/chrome/browser/gtk/repost_form_warning_gtk.h b/chrome/browser/gtk/repost_form_warning_gtk.h deleted file mode 100644 index 8b6f168..0000000 --- a/chrome/browser/gtk/repost_form_warning_gtk.h +++ /dev/null @@ -1,46 +0,0 @@ -// 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_GTK_REPOST_FORM_WARNING_GTK_H_ -#define CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ - -#include <gtk/gtk.h> - -#include "chrome/common/notification_registrar.h" - -class NavigationController; - -class RepostFormWarningGtk : public NotificationObserver { - public: - RepostFormWarningGtk(GtkWindow* parent, - NavigationController* navigation_controller); - virtual ~RepostFormWarningGtk(); - - private: - // NotificationObserver implementation. - // Watch for a new load or a closed tab and dismiss the dialog if they occur. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - // Tell Gtk to destroy the dialog window. This will only be done once, even - // if Destroy is called multiple times (eg, from both OnResponse and Observe.) - void Destroy(); - - static void OnResponse(GtkWidget* widget, - int response, - RepostFormWarningGtk* dialog); - static void OnWindowDestroy(GtkWidget* widget, RepostFormWarningGtk* dialog); - - NotificationRegistrar registrar_; - - // Navigation controller, used to continue the reload. - NavigationController* navigation_controller_; - - GtkWidget* dialog_; - - DISALLOW_COPY_AND_ASSIGN(RepostFormWarningGtk); -}; - -#endif // CHROME_BROWSER_GTK_REPOST_FORM_WARNING_GTK_H_ diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index 7f5fa99..3704169 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -16,8 +16,8 @@ #include "chrome/browser/renderer_host/site_instance.h" #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/browser/tab_contents/repost_form_warning.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/common/navigation_types.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" @@ -29,6 +29,11 @@ #include "net/base/net_util.h" #include "webkit/glue/webkit_glue.h" +#if defined(OS_WIN) +#include "chrome/browser/tab_contents/repost_form_warning.h" +#include "chrome/browser/tab_contents/tab_contents_delegate.h" +#endif + namespace { // Invoked when entries have been pruned, or removed. For example, if the @@ -168,7 +173,7 @@ void NavigationController::Reload(bool check_for_repost) { // they really want to do this. If they do, the dialog will call us back // with check_for_repost = false. tab_contents_->Activate(); - tab_contents_->delegate()->ShowRepostFormWarningDialog(tab_contents_); + RunRepostFormWarningDialog(this); } else { // Base the navigation on where we are now... int current_index = GetCurrentEntryIndex(); diff --git a/chrome/browser/tab_contents/repost_form_warning.h b/chrome/browser/tab_contents/repost_form_warning.h new file mode 100644 index 0000000..9bbbbaa --- /dev/null +++ b/chrome/browser/tab_contents/repost_form_warning.h @@ -0,0 +1,17 @@ +// 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_TAB_CONTENTS_REPOST_FORM_WARNING_H_ +#define CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_ + +class NavigationController; + +// Runs the form repost warning dialog. If the user accepts the action, then +// it will call Reload on the navigation controller back with check_for_repost +// set to false. +// +// This function is implemented by the platform-specific frontend. +void RunRepostFormWarningDialog(NavigationController* nav_controller); + +#endif // CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_ diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index 156bb18..3799569 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -221,9 +221,6 @@ class TabContentsDelegate { return false; } - // Shows the repost form confirmation dialog box. - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) {} - protected: ~TabContentsDelegate() {} diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index f9a627b..6dc9adf 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -35,7 +35,6 @@ #include "chrome/browser/views/frame/browser_frame.h" #include "chrome/browser/views/fullscreen_exit_bubble.h" #include "chrome/browser/views/infobars/infobar_container.h" -#include "chrome/browser/views/repost_form_warning_view.h" #include "chrome/browser/views/status_bubble_views.h" #include "chrome/browser/views/tab_contents/tab_contents_container.h" #include "chrome/browser/views/tabs/browser_tab_strip.h" @@ -930,10 +929,6 @@ void BrowserView::ShowNewProfileDialog() { browser::ShowNewProfileDialog(); } -void BrowserView::ShowRepostFormWarningDialog(TabContents* tab_contents) { - new RepostFormWarningView(GetNativeHandle(), &tab_contents->controller()); -} - void BrowserView::ConfirmBrowserCloseWithPendingDownloads() { DownloadInProgressConfirmDialogDelegate* delegate = new DownloadInProgressConfirmDialogDelegate(browser_.get()); diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index e59c8aa..d978c51 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -243,7 +243,6 @@ class BrowserView : public BrowserWindow, virtual void ShowPasswordManager(); virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); virtual void ConfirmBrowserCloseWithPendingDownloads(); virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, gfx::NativeWindow parent_window); diff --git a/chrome/browser/views/repost_form_warning_view.cc b/chrome/browser/views/repost_form_warning_view.cc index 074850d7..c9ef167 100644 --- a/chrome/browser/views/repost_form_warning_view.cc +++ b/chrome/browser/views/repost_form_warning_view.cc @@ -14,8 +14,14 @@ #include "views/controls/message_box_view.h" #include "views/window/window.h" +// Implementation of function declared in +// browser/tab_contents/repost_form_warning.h +void RunRepostFormWarningDialog(NavigationController* navigation_controller) { + RepostFormWarningView* dialog = + new RepostFormWarningView(navigation_controller); +} + RepostFormWarningView::RepostFormWarningView( - gfx::NativeWindow parent_window, NavigationController* navigation_controller) : navigation_controller_(navigation_controller), message_box_view_(NULL) { @@ -23,12 +29,19 @@ RepostFormWarningView::RepostFormWarningView( MessageBoxFlags::kIsConfirmMessageBox, l10n_util::GetString(IDS_HTTP_POST_WARNING), L""); - views::Window::CreateChromeWindow(parent_window, gfx::Rect(), this)->Show(); + // TODO(beng): fix this - this dialog box should be shown by a method on the + // Browser. + HWND root_hwnd = NULL; + if (BrowserList::GetLastActive()) { + root_hwnd = reinterpret_cast<HWND>(BrowserList::GetLastActive()-> + window()->GetNativeHandle()); + } + views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show(); registrar_.Add(this, NotificationType::LOAD_START, - Source<NavigationController>(navigation_controller_)); + NotificationService::AllSources()); registrar_.Add(this, NotificationType::TAB_CLOSING, - Source<NavigationController>(navigation_controller_)); + NotificationService::AllSources()); } RepostFormWarningView::~RepostFormWarningView() { @@ -82,9 +95,8 @@ void RepostFormWarningView::Observe(NotificationType type, // a navigation controller anymore. if (window() && navigation_controller_ && (type == NotificationType::LOAD_START || - type == NotificationType::TAB_CLOSING)) { - DCHECK_EQ(Source<NavigationController>(source).ptr(), - navigation_controller_); + type == NotificationType::TAB_CLOSING) && + Source<NavigationController>(source).ptr() == navigation_controller_) { navigation_controller_ = NULL; window()->Close(); } diff --git a/chrome/browser/views/repost_form_warning_view.h b/chrome/browser/views/repost_form_warning_view.h index 3c8538b..40db8ac 100644 --- a/chrome/browser/views/repost_form_warning_view.h +++ b/chrome/browser/views/repost_form_warning_view.h @@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_VIEWS_REPOST_FORM_WARNING_VIEW_H_ #define CHROME_BROWSER_VIEWS_REPOST_FORM_WARNING_VIEW_H_ -#include "base/gfx/native_widget_types.h" #include "chrome/common/notification_registrar.h" #include "views/window/dialog_delegate.h" @@ -18,9 +17,8 @@ class Window; class RepostFormWarningView : public views::DialogDelegate, public NotificationObserver { public: - // Use BrowserWindow::ShowRepostFormWarningDialog to use. - RepostFormWarningView(gfx::NativeWindow parent_window, - NavigationController* navigation_controller); + // Use RunRepostFormWarningDialog (declared in repost_form_warning.h) to use. + RepostFormWarningView(NavigationController* navigation_controller); virtual ~RepostFormWarningView(); // views::DialogDelegate Methods: diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 0e08bea..62b1aa9 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -1302,8 +1302,6 @@ 'browser/gtk/page_info_window_gtk.cc', 'browser/gtk/process_singleton_dialog.cc', 'browser/gtk/process_singleton_dialog.h', - 'browser/gtk/repost_form_warning_gtk.cc', - 'browser/gtk/repost_form_warning_gtk.h', 'browser/gtk/sad_tab_gtk.cc', 'browser/gtk/sad_tab_gtk.h', 'browser/gtk/slide_animator_gtk.cc', @@ -1792,6 +1790,7 @@ 'browser/tab_contents/render_view_host_delegate_helper.h', 'browser/tab_contents/render_view_host_manager.cc', 'browser/tab_contents/render_view_host_manager.h', + 'browser/tab_contents/repost_form_warning.h', 'browser/tab_contents/security_style.h', 'browser/tab_contents/tab_contents.cc', 'browser/tab_contents/tab_contents.h', diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index 78e4085..162a6ab 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -210,6 +210,13 @@ bool RLZTracker::RecordProductEvent(Product product, AccessPoint point, //-------------------------------------------------------------------------- +void RunRepostFormWarningDialog(NavigationController*) { + // http://code.google.com/p/chromium/issues/detail?id=19761 + NOTIMPLEMENTED(); +} + +//-------------------------------------------------------------------------- + MemoryDetails::MemoryDetails() { NOTIMPLEMENTED(); } diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 0ccab4e..47e0e86 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -148,6 +148,12 @@ class DockInfo { //--------------------------------------------------------------------------- // These stubs are for TabContents +class RepostFormWarningDialog { + public: + static void RunRepostFormWarningDialog(NavigationController*) { } + virtual ~RepostFormWarningDialog() { } +}; + class BaseDragSource { }; diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h index 45394cf..a7a06db 100644 --- a/chrome/test/test_browser_window.h +++ b/chrome/test/test_browser_window.h @@ -69,7 +69,6 @@ class TestBrowserWindow : public BrowserWindow { virtual void ShowPasswordManager() {} virtual void ShowSelectProfileDialog() {} virtual void ShowNewProfileDialog() {} - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) {} virtual void ConfirmBrowserCloseWithPendingDownloads() {} virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, gfx::NativeWindow parent_window) {} |