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

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

Issue 10806079: Add support for invoking the Windows 8 metro style hung renderer dialog box. The dialog box (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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') | chrome/browser/ui/views/hung_renderer_view_win.h » ('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
===================================================================
--- chrome/browser/ui/views/hung_renderer_view.cc (revision 147919)
+++ chrome/browser/ui/views/hung_renderer_view.cc (working copy)
@@ -39,10 +39,21 @@
#include "ui/aura/window.h"
#endif
-#if defined(OS_WIN)
-#include "chrome/browser/hang_monitor/hang_crash_dump_win.h"
-#endif
+// These functions allow certain chrome platforms to override the default hung
+// renderer dialog. For e.g. Chrome on Windows 8 metro
+bool PlatformShowCustomHungRendererDialog(WebContents* contents);
+bool PlatformHideCustomHungRendererDialog(WebContents* contents);
+#if !defined(OS_WIN)
+bool PlatformShowCustomHungRendererDialog(WebContents* contents) {
+ return false;
+}
+
+bool PlatformHideCustomHungRendererDialog(WebContents* contents) {
+ return false;
+}
+#endif // OS_WIN
+
HungRendererDialogView* HungRendererDialogView::g_instance_ = NULL;
///////////////////////////////////////////////////////////////////////////////
@@ -173,8 +184,6 @@
///////////////////////////////////////////////////////////////////////////////
// HungRendererDialogView, public:
-#if !defined(OS_WIN)
-
// static
HungRendererDialogView* HungRendererDialogView::Create() {
if (!g_instance_) {
@@ -183,13 +192,28 @@
}
return g_instance_;
}
-#endif // defined(OS_WIN)
// static
HungRendererDialogView* HungRendererDialogView::GetInstance() {
return g_instance_;
}
+// static
+bool HungRendererDialogView::IsFrameActive(WebContents* contents) {
+ gfx::NativeView frame_view =
+ platform_util::GetTopLevel(contents->GetNativeView());
+ return platform_util::IsWindowActive(frame_view);
+}
+
+#if !defined(OS_WIN)
+// static
+void HungRendererDialogView::KillRendererProcess(
+ base::ProcessHandle process_handle) {
+ base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false);
+}
+#endif // OS_WIN
+
+
HungRendererDialogView::HungRendererDialogView()
: hung_pages_table_(NULL),
kill_button_(NULL),
@@ -208,7 +232,8 @@
// Don't show the warning unless the foreground window is the frame, or this
// window (but still invisible). If the user has another window or
// application selected, activating ourselves is rude.
- if (!IsFrameActive(contents))
+ if (!IsFrameActive(contents) &&
+ !platform_util::IsWindowActive(GetWidget()->GetNativeWindow()))
return;
if (!GetWidget()->IsActive()) {
@@ -306,13 +331,7 @@
base::ProcessHandle process_handle =
hung_pages_table_model_->GetRenderProcessHost()->GetHandle();
-#if defined(OS_WIN)
- // Try to generate a crash report for the hung process.
- CrashDumpAndTerminateHungChildProcess(process_handle);
-#else
- // Kill the process.
- base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false);
-#endif
+ KillRendererProcess(process_handle);
}
}
@@ -333,16 +352,6 @@
Init();
}
-bool HungRendererDialogView::IsFrameActive(WebContents* contents) {
- gfx::NativeView frame_view =
- platform_util::GetTopLevel(contents->GetNativeView());
- if (!platform_util::IsWindowActive(frame_view) &&
- !platform_util::IsWindowActive(GetWidget()->GetNativeWindow())) {
- return false;
- }
- return true;
-}
-
///////////////////////////////////////////////////////////////////////////////
// HungRendererDialogView, private:
@@ -452,7 +461,8 @@
namespace chrome {
void ShowHungRendererDialog(WebContents* contents) {
- if (!logging::DialogsAreSuppressed()) {
+ if (!logging::DialogsAreSuppressed() &&
+ !PlatformShowCustomHungRendererDialog(contents)) {
HungRendererDialogView* view = HungRendererDialogView::Create();
view->ShowForWebContents(contents);
}
@@ -460,6 +470,7 @@
void HideHungRendererDialog(WebContents* contents) {
if (!logging::DialogsAreSuppressed() &&
+ !PlatformHideCustomHungRendererDialog(contents) &&
HungRendererDialogView::GetInstance())
HungRendererDialogView::GetInstance()->EndForWebContents(contents);
}
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.h ('k') | chrome/browser/ui/views/hung_renderer_view_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698