summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 20:17:07 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 20:17:07 +0000
commitb5bb35f1ddd2e113089e329b024a4fb843d038fb (patch)
tree7fc3944bb8cbcf56e7adcbf11e15929740fccb69 /chrome/browser
parent031c7baebf04ef2351953c62e494057835bf5277 (diff)
downloadchromium_src-b5bb35f1ddd2e113089e329b024a4fb843d038fb.zip
chromium_src-b5bb35f1ddd2e113089e329b024a4fb843d038fb.tar.gz
chromium_src-b5bb35f1ddd2e113089e329b024a4fb843d038fb.tar.bz2
Move resource_message_filter and resource_request_details to the renderer_host.
Make the repost form warning portable by abstracting the show function from the view. Rename the Windows repost form warning and move it to browser/views. This also fixes a comment in browser_process.h Review URL: http://codereview.chromium.org/20066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser.scons12
-rw-r--r--chrome/browser/browser.vcproj40
-rw-r--r--chrome/browser/browser_process.h3
-rw-r--r--chrome/browser/plugin_process_host.h5
-rw-r--r--chrome/browser/plugin_service.cc2
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc2
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc2
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc (renamed from chrome/browser/resource_message_filter.cc)2
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h (renamed from chrome/browser/resource_message_filter.h)10
-rw-r--r--chrome/browser/renderer_host/resource_request_details.h (renamed from chrome/browser/resource_request_details.h)17
-rw-r--r--chrome/browser/ssl/ssl_manager.cc2
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc7
-rw-r--r--chrome/browser/tab_contents/repost_form_warning.h17
-rw-r--r--chrome/browser/task_manager_resource_providers.cc2
-rw-r--r--chrome/browser/views/browser_views.vcproj8
-rw-r--r--chrome/browser/views/repost_form_warning_view.cc (renamed from chrome/browser/repost_form_warning_dialog.cc)83
-rw-r--r--chrome/browser/views/repost_form_warning_view.h (renamed from chrome/browser/repost_form_warning_dialog.h)22
17 files changed, 121 insertions, 115 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index 337dcdf..653d211 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -127,9 +127,6 @@ input_files = ChromeFileList([
'profile.h',
'profile_manager.cc',
'profile_manager.h',
- 'resource_message_filter.cc',
- 'resource_message_filter.h',
- 'resource_request_details.h',
'session_startup_pref.cc',
'session_startup_pref.h',
'shell_dialogs.h',
@@ -193,8 +190,6 @@ input_files = ChromeFileList([
'login_prompt.cc',
'login_prompt.h',
'options_window.h',
- 'repost_form_warning_dialog.cc',
- 'repost_form_warning_dialog.h',
'task_manager.cc',
'task_manager.h',
'task_manager_resource_providers.cc',
@@ -544,6 +539,9 @@ input_files = ChromeFileList([
'renderer_host/resource_dispatcher_host.cc',
'renderer_host/resource_dispatcher_host.h',
'renderer_host/resource_handler.h',
+ 'renderer_host/resource_message_filter.cc',
+ 'renderer_host/resource_message_filter.h',
+ 'renderer_host/resource_request_details.h',
'renderer_host/safe_browsing_resource_handler.cc',
'renderer_host/safe_browsing_resource_handler.h',
'renderer_host/save_file_resource_handler.cc',
@@ -576,6 +574,7 @@ input_files = ChromeFileList([
'tab_contents/render_view_context_menu_controller.h',
'tab_contents/render_view_host_manager.cc',
'tab_contents/render_view_host_manager.h',
+ 'tab_contents/repost_form_warning.h',
'tab_contents/security_style.h',
'tab_contents/site_instance.cc',
'tab_contents/site_instance.h',
@@ -751,8 +750,7 @@ if not env.Bit('windows'):
'printing/printer_query.cc',
'printing/win_printing_context.cc',
'renderer_host/cross_site_resource_handler.cc',
- 'repost_form_warning_dialog.cc',
- 'resource_message_filter.cc',
+ 'renderer_host/resource_message_filter.cc',
'rlz/rlz.cc',
'safe_browsing/protocol_manager.cc',
'safe_browsing/safe_browsing_blocking_page.cc',
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj
index 1dd27d8..38536b9 100644
--- a/chrome/browser/browser.vcproj
+++ b/chrome/browser/browser.vcproj
@@ -490,18 +490,6 @@
>
</File>
<File
- RelativePath=".\resource_message_filter.cc"
- >
- </File>
- <File
- RelativePath=".\resource_message_filter.h"
- >
- </File>
- <File
- RelativePath=".\resource_request_details.h"
- >
- </File>
- <File
RelativePath=".\session_startup_pref.cc"
>
</File>
@@ -750,14 +738,6 @@
>
</File>
<File
- RelativePath=".\repost_form_warning_dialog.cc"
- >
- </File>
- <File
- RelativePath=".\repost_form_warning_dialog.h"
- >
- </File>
- <File
RelativePath=".\status_bubble.h"
>
</File>
@@ -986,11 +966,11 @@
>
</File>
<File
- RelativePath=".\history\history_publisher_win.cc"
+ RelativePath=".\history\history_publisher.h"
>
</File>
<File
- RelativePath=".\history\history_publisher.h"
+ RelativePath=".\history\history_publisher_win.cc"
>
</File>
<File
@@ -2070,6 +2050,18 @@
>
</File>
<File
+ RelativePath=".\renderer_host\resource_message_filter.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\renderer_host\resource_message_filter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\renderer_host\resource_request_details.h"
+ >
+ </File>
+ <File
RelativePath=".\renderer_host\safe_browsing_resource_handler.cc"
>
</File>
@@ -2186,6 +2178,10 @@
>
</File>
<File
+ RelativePath=".\tab_contents\repost_form_warning.h"
+ >
+ </File>
+ <File
RelativePath=".\tab_contents\security_style.h"
>
</File>
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
index b4f6a46..6eee7a7 100644
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -90,7 +90,8 @@ class BrowserProcess {
// It might be nicer to have a thread pool for this kind of thing.
virtual base::Thread* file_thread() = 0;
- // Returns the thread that is used for database operations such as history.
+ // Returns the thread that is used for database operations such as the web
+ // database. History has its own thread since it has much higher traffic.
virtual base::Thread* db_thread() = 0;
virtual sandbox::BrokerServices* broker_services() = 0;
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index 21adb90..45eeaab 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -13,10 +13,9 @@
#include "base/process.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "chrome/browser/resource_message_filter.h"
-#include "chrome/common/ipc_channel_proxy.h"
#include "chrome/browser/net/resolve_proxy_msg_helper.h"
-#include "chrome/browser/resource_message_filter.h"
+#include "chrome/browser/renderer_host/resource_message_filter.h"
+#include "chrome/common/ipc_channel_proxy.h"
class PluginService;
class PluginProcessHost;
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index 032842c..aeec45b 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -11,7 +11,7 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/plugin_process_host.h"
#include "chrome/browser/renderer_host/render_process_host.h"
-#include "chrome/browser/resource_message_filter.h"
+#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/logging_chrome.h"
#include "webkit/glue/plugins/plugin_list.h"
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 32ee2fd..42f02c4c7 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -30,7 +30,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_widget_helper.h"
#include "chrome/browser/renderer_host/renderer_security_policy.h"
-#include "chrome/browser/resource_message_filter.h"
+#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/browser/visitedlink_master.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 8d12aac..586e823 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -16,10 +16,10 @@
#include "chrome/browser/renderer_host/buffered_resource_handler.h"
#include "chrome/browser/renderer_host/download_resource_handler.h"
#include "chrome/browser/renderer_host/renderer_security_policy.h"
+#include "chrome/browser/renderer_host/resource_request_details.h"
#include "chrome/browser/renderer_host/safe_browsing_resource_handler.h"
#include "chrome/browser/renderer_host/save_file_resource_handler.h"
#include "chrome/browser/renderer_host/sync_resource_handler.h"
-#include "chrome/browser/resource_request_details.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/notification_service.h"
diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 8d404c5..15b3f28 100644
--- a/chrome/browser/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/resource_message_filter.h"
+#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "base/clipboard.h"
#include "base/gfx/native_widget_types.h"
diff --git a/chrome/browser/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index 6b2db32..cd07729 100644
--- a/chrome/browser/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_
-#define CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_
+#ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_MSG_FILTER_H_
+#define CHROME_BROWSER_RENDERER_HOST_RESOURCE_MSG_FILTER_H_
#include "base/clipboard.h"
#include "base/file_path.h"
@@ -12,7 +12,6 @@
#include "base/ref_counted.h"
#include "build/build_config.h"
#include "chrome/browser/net/resolve_proxy_msg_helper.h"
-#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/common/ipc_channel_proxy.h"
#include "chrome/common/modal_dialog_event.h"
#include "chrome/common/notification_observer.h"
@@ -20,7 +19,9 @@
#if defined(OS_WIN)
#include <windows.h>
+#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#else
+// TODO(port): port ResourceDispatcherHost.
#include "chrome/common/temp_scaffolding_stubs.h"
#endif
@@ -28,7 +29,6 @@ class ClipboardService;
class Profile;
class RenderWidgetHelper;
class SpellChecker;
-struct ViewHostMsg_Resource_Request;
struct WebPluginInfo;
namespace printing {
@@ -242,4 +242,4 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter);
};
-#endif // CHROME_BROWSER_RENDERER_RESOURCE_MSG_FILTER_H_
+#endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_MSG_FILTER_H_
diff --git a/chrome/browser/resource_request_details.h b/chrome/browser/renderer_host/resource_request_details.h
index d8cd0cc..db5ac89 100644
--- a/chrome/browser/resource_request_details.h
+++ b/chrome/browser/renderer_host/resource_request_details.h
@@ -6,24 +6,18 @@
// resource request. It copies many of the publicly accessible member variables
// of URLRequest, but exists on the UI thread.
-#ifndef CHROME_BROWSER_RESOURCE_REQUEST_DETAILS_H__
-#define CHROME_BROWSER_RESOURCE_REQUEST_DETAILS_H__
+#ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_DETAILS_H_
+#define CHROME_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_DETAILS_H_
#include <string>
#include "base/basictypes.h"
+#include "chrome/browser/cert_store.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_status.h"
-#if defined(OS_WIN)
-// TODO(port): Move header to the above section when CertStore has been ported.
-#include "chrome/browser/cert_store.h"
-#elif defined(OS_POSIX)
-#include "chrome/common/temp_scaffolding_stubs.h"
-#endif
-
// Details about a resource request notification.
class ResourceRequestDetails {
public:
@@ -70,7 +64,7 @@ class ResourceRequestDetails {
int ssl_cert_status_;
ResourceType::Type resource_type_;
- DISALLOW_EVIL_CONSTRUCTORS(ResourceRequestDetails);
+ DISALLOW_COPY_AND_ASSIGN(ResourceRequestDetails);
};
// Details about a redirection of a resource request.
@@ -89,5 +83,4 @@ class ResourceRedirectDetails : public ResourceRequestDetails {
GURL new_url_;
};
-#endif // CHROME_BROWSER_RESOURCE_REQUEST_DETAILS_H__
-
+#endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_DETAILS_H_
diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc
index 99440b9..e92247b 100644
--- a/chrome/browser/ssl/ssl_manager.cc
+++ b/chrome/browser/ssl/ssl_manager.cc
@@ -11,7 +11,7 @@
#include "chrome/browser/load_notification_details.h"
#include "chrome/browser/load_from_memory_cache_details.h"
#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/resource_request_details.h"
+#include "chrome/browser/renderer_host/resource_request_details.h"
#include "chrome/browser/ssl/ssl_error_info.h"
#include "chrome/browser/ssl/ssl_policy.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index 1e567f1..6b94764 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/dom_ui/dom_ui_host.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/site_instance.h"
#include "chrome/common/navigation_types.h"
#include "chrome/common/notification_service.h"
@@ -216,10 +217,10 @@ void NavigationController::Reload(bool check_for_repost) {
if (check_for_repost_ && check_for_repost && current_index != -1 &&
GetEntryAtIndex(current_index)->has_post_data()) {
// The user is asking to reload a page with POST data. Prompt to make sure
- // they really want to do this. If they do, RepostFormWarningDialog calls us
- // back with ReloadDontCheckForRepost.
+ // they really want to do this. If they do, the dialog will call us back
+ // with check_for_repost = false.
active_contents_->Activate();
- RepostFormWarningDialog::RunRepostFormWarningDialog(this);
+ 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..33588dc
--- /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/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index c0e94c9..ceb48cc 100644
--- a/chrome/browser/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager_resource_providers.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/plugin_process_host.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/renderer_host/render_process_host.h"
-#include "chrome/browser/resource_message_filter.h"
+#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/notification_service.h"
diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj
index 3a85578..265a745 100644
--- a/chrome/browser/views/browser_views.vcproj
+++ b/chrome/browser/views/browser_views.vcproj
@@ -698,6 +698,14 @@
>
</File>
<File
+ RelativePath=".\repost_form_warning_view.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\repost_form_warning_view.h"
+ >
+ </File>
+ <File
RelativePath=".\restart_message_box.cc"
>
</File>
diff --git a/chrome/browser/repost_form_warning_dialog.cc b/chrome/browser/views/repost_form_warning_view.cc
index 898c6c5..87d90c9 100644
--- a/chrome/browser/repost_form_warning_dialog.cc
+++ b/chrome/browser/views/repost_form_warning_view.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/repost_form_warning_dialog.h"
+#include "chrome/browser/views/repost_form_warning_view.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
@@ -13,17 +13,36 @@
#include "generated_resources.h"
-///////////////////////////////////////////////////////////////////////////////
-// RepostFormWarningDialog, public:
+// Implementation of function declared in
+// browser/tab_contents/repost_form_warning.h
+void RunRepostFormWarningDialog(NavigationController* navigation_controller) {
+ RepostFormWarningView* dialog =
+ new RepostFormWarningView(navigation_controller);
+}
-// static
-void RepostFormWarningDialog::RunRepostFormWarningDialog(
- NavigationController* navigation_controller) {
- RepostFormWarningDialog* dialog =
- new RepostFormWarningDialog(navigation_controller);
+RepostFormWarningView::RepostFormWarningView(
+ NavigationController* navigation_controller)
+ : navigation_controller_(navigation_controller),
+ message_box_view_(NULL) {
+ message_box_view_ = new MessageBoxView(
+ MessageBoxView::kIsConfirmMessageBox,
+ l10n_util::GetString(IDS_HTTP_POST_WARNING),
+ L"");
+ // 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();
+ NotificationService::current()->AddObserver(
+ this, NotificationType::LOAD_START, NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::TAB_CLOSING, NotificationService::AllSources());
}
-RepostFormWarningDialog::~RepostFormWarningDialog() {
+RepostFormWarningView::~RepostFormWarningView() {
NotificationService::current()->RemoveObserver(
this, NotificationType::LOAD_START, NotificationService::AllSources());
NotificationService::current()->RemoveObserver(
@@ -31,13 +50,13 @@ RepostFormWarningDialog::~RepostFormWarningDialog() {
}
//////////////////////////////////////////////////////////////////////////////
-// RepostFormWarningDialog, views::DialogDelegate implementation:
+// RepostFormWarningView, views::DialogDelegate implementation:
-std::wstring RepostFormWarningDialog::GetWindowTitle() const {
+std::wstring RepostFormWarningView::GetWindowTitle() const {
return l10n_util::GetString(IDS_HTTP_POST_WARNING_TITLE);
}
-std::wstring RepostFormWarningDialog::GetDialogButtonLabel(
+std::wstring RepostFormWarningView::GetDialogButtonLabel(
DialogButton button) const {
if (button == DialogDelegate::DIALOGBUTTON_OK)
return l10n_util::GetString(IDS_HTTP_POST_WARNING_RESEND);
@@ -46,55 +65,33 @@ std::wstring RepostFormWarningDialog::GetDialogButtonLabel(
return L"";
}
-void RepostFormWarningDialog::WindowClosing() {
+void RepostFormWarningView::WindowClosing() {
delete this;
}
-bool RepostFormWarningDialog::Cancel() {
+bool RepostFormWarningView::Cancel() {
return true;
}
-bool RepostFormWarningDialog::Accept() {
+bool RepostFormWarningView::Accept() {
if (navigation_controller_)
navigation_controller_->Reload(false);
return true;
}
///////////////////////////////////////////////////////////////////////////////
-// RepostFormWarningDialog, views::WindowDelegate implementation:
+// RepostFormWarningView, views::WindowDelegate implementation:
-views::View* RepostFormWarningDialog::GetContentsView() {
+views::View* RepostFormWarningView::GetContentsView() {
return message_box_view_;
}
///////////////////////////////////////////////////////////////////////////////
-// RepostFormWarningDialog, private:
-
-RepostFormWarningDialog::RepostFormWarningDialog(
- NavigationController* navigation_controller)
- : navigation_controller_(navigation_controller),
- message_box_view_(NULL) {
- message_box_view_ = new MessageBoxView(
- MessageBoxView::kIsConfirmMessageBox,
- l10n_util::GetString(IDS_HTTP_POST_WARNING),
- L"");
- // 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();
- NotificationService::current()->AddObserver(
- this, NotificationType::LOAD_START, NotificationService::AllSources());
- NotificationService::current()->AddObserver(
- this, NotificationType::TAB_CLOSING, NotificationService::AllSources());
-}
+// RepostFormWarningView, private:
-void RepostFormWarningDialog::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
+void RepostFormWarningView::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.
diff --git a/chrome/browser/repost_form_warning_dialog.h b/chrome/browser/views/repost_form_warning_view.h
index 3e41f63..db8f76b 100644
--- a/chrome/browser/repost_form_warning_dialog.h
+++ b/chrome/browser/views/repost_form_warning_view.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_REPOST_FORM_WARNING_H_
-#define CHROME_BROWSER_REPOST_FORM_WARNING_H_
+#ifndef CHROME_BROWSER_VIEWS_REPOST_FORM_WARNING_VIEW_H_
+#define CHROME_BROWSER_VIEWS_REPOST_FORM_WARNING_VIEW_H_
#include "chrome/common/notification_observer.h"
#include "chrome/views/dialog_delegate.h"
@@ -14,14 +14,12 @@ namespace views {
class Window;
}
-class RepostFormWarningDialog : public views::DialogDelegate,
- public NotificationObserver {
+class RepostFormWarningView : public views::DialogDelegate,
+ public NotificationObserver {
public:
- // Creates and runs a message box which asks the user if they want to resend
- // an HTTP POST.
- static void RunRepostFormWarningDialog(
- NavigationController* navigation_controller);
- virtual ~RepostFormWarningDialog();
+ // Use RunRepostFormWarningDialog (declared in repost_form_warning.h) to use.
+ RepostFormWarningView(NavigationController* navigation_controller);
+ virtual ~RepostFormWarningView();
// views::DialogDelegate Methods:
virtual std::wstring GetWindowTitle() const;
@@ -35,8 +33,6 @@ class RepostFormWarningDialog : public views::DialogDelegate,
virtual views::View* GetContentsView();
private:
- // Use RunRepostFormWarningDialog to use.
- RepostFormWarningDialog(NavigationController* navigation_controller);
// NotificationObserver implementation.
// Watch for a new load or a closed tab and dismiss the dialog if they occur.
@@ -50,7 +46,7 @@ class RepostFormWarningDialog : public views::DialogDelegate,
// Navigation controller, used to continue the reload.
NavigationController* navigation_controller_;
- DISALLOW_COPY_AND_ASSIGN(RepostFormWarningDialog);
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningView);
};
-#endif // CHROME_BROWSER_REPOST_FORM_WARNING_H_
+#endif // CHROME_BROWSER_VIEWS_REPOST_FORM_WARNING_VIEW_H_