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

Side by Side Diff: chrome/browser/ui/views/hung_renderer_view.cc

Issue 243703003: Removes win8_util (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/hung_renderer_view.h" 5 #include "chrome/browser/ui/views/hung_renderer_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
11 #include "chrome/browser/platform_util.h" 11 #include "chrome/browser/platform_util.h"
12 #include "chrome/browser/ui/browser_dialogs.h" 12 #include "chrome/browser/ui/browser_dialogs.h"
13 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" 14 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h"
15 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 15 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 16 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
17 #include "chrome/browser/ui/views/constrained_window_views.h" 17 #include "chrome/browser/ui/views/constrained_window_views.h"
18 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/logging_chrome.h" 19 #include "chrome/common/logging_chrome.h"
20 #include "components/web_modal/web_contents_modal_dialog_host.h" 20 #include "components/web_modal/web_contents_modal_dialog_host.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_contents_view.h" 24 #include "content/public/browser/web_contents_view.h"
25 #include "content/public/common/result_codes.h" 25 #include "content/public/common/result_codes.h"
26 #include "grit/chromium_strings.h" 26 #include "grit/chromium_strings.h"
27 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
28 #include "grit/theme_resources.h" 28 #include "grit/theme_resources.h"
29 #include "ui/aura/window.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/canvas.h" 32 #include "ui/gfx/canvas.h"
32 #include "ui/views/controls/button/label_button.h" 33 #include "ui/views/controls/button/label_button.h"
33 #include "ui/views/controls/image_view.h" 34 #include "ui/views/controls/image_view.h"
34 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
35 #include "ui/views/layout/grid_layout.h" 36 #include "ui/views/layout/grid_layout.h"
36 #include "ui/views/layout/layout_constants.h" 37 #include "ui/views/layout/layout_constants.h"
37 #include "ui/views/widget/widget.h" 38 #include "ui/views/widget/widget.h"
38 #include "ui/views/window/client_view.h" 39 #include "ui/views/window/client_view.h"
39 40
40 #if defined(OS_WIN) 41 #if defined(OS_WIN)
42 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h"
41 #include "chrome/browser/profiles/profile.h" 43 #include "chrome/browser/profiles/profile.h"
42 #include "chrome/browser/shell_integration.h" 44 #include "chrome/browser/shell_integration.h"
43 #include "ui/base/win/shell.h" 45 #include "ui/base/win/shell.h"
44 #include "ui/views/win/hwnd_util.h" 46 #include "ui/views/win/hwnd_util.h"
45 #endif 47 #endif
46 48
47 #if defined(USE_AURA)
48 #include "ui/aura/window.h"
49 #endif
50
51 #if defined(OS_WIN) 49 #if defined(OS_WIN)
52 #include "ui/base/win/shell.h" 50 #include "ui/base/win/shell.h"
53 #endif 51 #endif
54 52
55 using content::WebContents; 53 using content::WebContents;
56 54
57 // These functions allow certain chrome platforms to override the default hung
58 // renderer dialog. For e.g. Chrome on Windows 8 metro
59 bool PlatformShowCustomHungRendererDialog(WebContents* contents);
60 bool PlatformHideCustomHungRendererDialog(WebContents* contents);
61
62 #if !defined(OS_WIN)
63 bool PlatformShowCustomHungRendererDialog(WebContents* contents) {
64 return false;
65 }
66
67 bool PlatformHideCustomHungRendererDialog(WebContents* contents) {
68 return false;
69 }
70 #endif // OS_WIN
71
72 HungRendererDialogView* HungRendererDialogView::g_instance_ = NULL; 55 HungRendererDialogView* HungRendererDialogView::g_instance_ = NULL;
73 56
74 /////////////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////////////
75 // HungPagesTableModel, public: 58 // HungPagesTableModel, public:
76 59
77 HungPagesTableModel::HungPagesTableModel(Delegate* delegate) 60 HungPagesTableModel::HungPagesTableModel(Delegate* delegate)
78 : observer_(NULL), 61 : observer_(NULL),
79 delegate_(delegate) { 62 delegate_(delegate) {
80 } 63 }
81 64
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return g_instance_; 194 return g_instance_;
212 } 195 }
213 196
214 // static 197 // static
215 bool HungRendererDialogView::IsFrameActive(WebContents* contents) { 198 bool HungRendererDialogView::IsFrameActive(WebContents* contents) {
216 gfx::NativeView frame_view = 199 gfx::NativeView frame_view =
217 platform_util::GetTopLevel(contents->GetView()->GetNativeView()); 200 platform_util::GetTopLevel(contents->GetView()->GetNativeView());
218 return platform_util::IsWindowActive(frame_view); 201 return platform_util::IsWindowActive(frame_view);
219 } 202 }
220 203
221 #if !defined(OS_WIN)
222 // static 204 // static
223 void HungRendererDialogView::KillRendererProcess( 205 void HungRendererDialogView::KillRendererProcess(
224 base::ProcessHandle process_handle) { 206 base::ProcessHandle process_handle) {
207 #if defined(OS_WIN)
208 // Try to generate a crash report for the hung process.
209 CrashDumpAndTerminateHungChildProcess(process_handle);
210 #else
225 base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false); 211 base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false);
212 #endif
226 } 213 }
227 #endif // OS_WIN
228 214
229 215
230 HungRendererDialogView::HungRendererDialogView() 216 HungRendererDialogView::HungRendererDialogView()
231 : hung_pages_table_(NULL), 217 : hung_pages_table_(NULL),
232 kill_button_(NULL), 218 kill_button_(NULL),
233 initialized_(false) { 219 initialized_(false) {
234 InitClass(); 220 InitClass();
235 } 221 }
236 222
237 HungRendererDialogView::~HungRendererDialogView() { 223 HungRendererDialogView::~HungRendererDialogView() {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if (!initialized) { 430 if (!initialized) {
445 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 431 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
446 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); 432 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON);
447 initialized = true; 433 initialized = true;
448 } 434 }
449 } 435 }
450 436
451 namespace chrome { 437 namespace chrome {
452 438
453 void ShowHungRendererDialog(WebContents* contents) { 439 void ShowHungRendererDialog(WebContents* contents) {
454 if (!logging::DialogsAreSuppressed() && 440 if (logging::DialogsAreSuppressed())
455 !PlatformShowCustomHungRendererDialog(contents)) { 441 return;
456 gfx::NativeView toplevel_view = 442
457 platform_util::GetTopLevel(contents->GetView()->GetNativeView()); 443 gfx::NativeView toplevel_view =
458 #if defined(USE_AURA) 444 platform_util::GetTopLevel(contents->GetView()->GetNativeView());
459 // Don't show the dialog if there is no root window for the renderer, 445 // Don't show the dialog if there is no root window for the renderer, because
460 // because it's invisible to the user (happens when the renderer is for 446 // it's invisible to the user (happens when the renderer is for prerendering
461 // prerendering for example). 447 // for example).
462 if (!toplevel_view->GetRootWindow()) 448 if (!toplevel_view->GetRootWindow())
463 return; 449 return;
464 #endif 450 HungRendererDialogView* view = HungRendererDialogView::Create(toplevel_view);
465 HungRendererDialogView* view = HungRendererDialogView::Create( 451 view->ShowForWebContents(contents);
466 toplevel_view);
467 view->ShowForWebContents(contents);
468 }
469 } 452 }
470 453
471 void HideHungRendererDialog(WebContents* contents) { 454 void HideHungRendererDialog(WebContents* contents) {
472 if (!logging::DialogsAreSuppressed() && 455 if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance())
473 !PlatformHideCustomHungRendererDialog(contents) &&
474 HungRendererDialogView::GetInstance())
475 HungRendererDialogView::GetInstance()->EndForWebContents(contents); 456 HungRendererDialogView::GetInstance()->EndForWebContents(contents);
476 } 457 }
477 458
478 } // namespace chrome 459 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc ('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