Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: chrome/browser/ui/views/hung_renderer_view.cc

Issue 1752623004: Remove DialogDelegate::Accept() variant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/hung_renderer_view.cc
diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index d54d16544ea0e28aa39ae4b215037368baff044a..0e7622437f63c0bfd2ce2753837a6c1fb8d4f2d6 100644
--- a/chrome/browser/ui/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
@@ -223,23 +223,12 @@ bool HungRendererDialogView::IsFrameActive(WebContents* contents) {
return platform_util::IsWindowActive(window);
}
-// static
-void HungRendererDialogView::KillRendererProcess(
- content::RenderProcessHost* rph) {
-#if defined(OS_WIN)
- // Try to generate a crash report for the hung process.
- CrashDumpAndTerminateHungChildProcess(rph->GetHandle());
-#else
- rph->Shutdown(content::RESULT_CODE_HUNG, false);
-#endif
-}
-
-
HungRendererDialogView::HungRendererDialogView()
: info_label_(nullptr),
hung_pages_table_(nullptr),
kill_button_(nullptr),
- initialized_(false) {
+ initialized_(false),
+ kill_button_clicked_(false) {
InitClass();
}
@@ -332,20 +321,13 @@ void HungRendererDialogView::WindowClosing() {
}
int HungRendererDialogView::GetDialogButtons() const {
- // We specifically don't want a CANCEL button here because that code path is
- // also called when the window is closed by the user clicking the X button in
- // the window's titlebar, and also if we call Window::Close. Rather, we want
- // the OK button to wait for responsiveness (and close the dialog) and our
- // additional button (which we create) to kill the process (which will result
- // in the dialog being destroyed).
- return ui::DIALOG_BUTTON_OK;
+ return ui::DIALOG_BUTTON_CANCEL;
}
base::string16 HungRendererDialogView::GetDialogButtonLabel(
ui::DialogButton button) const {
- if (button == ui::DIALOG_BUTTON_OK)
- return l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT);
- return views::DialogDelegateView::GetDialogButtonLabel(button);
+ DCHECK_EQ(ui::DIALOG_BUTTON_CANCEL, button);
+ return l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT);
}
views::View* HungRendererDialogView::CreateExtraView() {
@@ -356,14 +338,10 @@ views::View* HungRendererDialogView::CreateExtraView() {
return kill_button_;
}
-bool HungRendererDialogView::Accept(bool window_closing) {
- // Don't do anything if we're being called only because the dialog is being
- // destroyed and we don't supply a Cancel function...
- if (window_closing)
- return true;
-
+bool HungRendererDialogView::Cancel() {
// Start waiting again for responsiveness.
- if (hung_pages_table_model_->GetRenderViewHost()) {
+ if (!kill_button_clicked_ &&
+ hung_pages_table_model_->GetRenderViewHost()) {
hung_pages_table_model_->GetRenderViewHost()
->GetWidget()
->RestartHangMonitorTimeout();
@@ -371,7 +349,6 @@ bool HungRendererDialogView::Accept(bool window_closing) {
return true;
}
-
bool HungRendererDialogView::UseNewStyleForThisDialog() const {
#if defined(OS_WIN)
// Use the old dialog style without Aero glass, otherwise the dialog will be
@@ -387,10 +364,18 @@ bool HungRendererDialogView::UseNewStyleForThisDialog() const {
void HungRendererDialogView::ButtonPressed(
views::Button* sender, const ui::Event& event) {
- if (sender == kill_button_ &&
- hung_pages_table_model_->GetRenderProcessHost()) {
- KillRendererProcess(hung_pages_table_model_->GetRenderProcessHost());
- }
+ DCHECK_EQ(kill_button_, sender);
+ kill_button_clicked_ = true;
+ content::RenderProcessHost* rph =
+ hung_pages_table_model_->GetRenderProcessHost();
+ if (!rph)
+ return;
+#if defined(OS_WIN)
+ // Try to generate a crash report for the hung process.
+ CrashDumpAndTerminateHungChildProcess(rph->GetHandle());
+#else
+ rph->Shutdown(content::RESULT_CODE_HUNG, false);
+#endif
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.h ('k') | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698