| OLD | NEW |
| 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/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "components/favicon/content/content_favicon_driver.h" | 23 #include "components/favicon/content/content_favicon_driver.h" |
| 24 #include "components/web_modal/web_contents_modal_dialog_host.h" | 24 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 25 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
| 26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
| 27 #include "content/public/browser/render_widget_host.h" | 27 #include "content/public/browser/render_widget_host.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/common/result_codes.h" | 29 #include "content/public/common/result_codes.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
| 33 #include "ui/gfx/view_util.h" |
| 33 #include "ui/views/controls/button/md_text_button.h" | 34 #include "ui/views/controls/button/md_text_button.h" |
| 34 #include "ui/views/controls/image_view.h" | 35 #include "ui/views/controls/image_view.h" |
| 35 #include "ui/views/controls/label.h" | 36 #include "ui/views/controls/label.h" |
| 36 #include "ui/views/layout/grid_layout.h" | 37 #include "ui/views/layout/grid_layout.h" |
| 37 #include "ui/views/layout/layout_constants.h" | 38 #include "ui/views/layout/layout_constants.h" |
| 38 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 39 #include "ui/views/window/client_view.h" | 40 #include "ui/views/window/client_view.h" |
| 40 | 41 |
| 41 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 42 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" | 43 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return g_instance_; | 200 return g_instance_; |
| 200 } | 201 } |
| 201 | 202 |
| 202 // static | 203 // static |
| 203 void HungRendererDialogView::Show( | 204 void HungRendererDialogView::Show( |
| 204 WebContents* contents, | 205 WebContents* contents, |
| 205 const WebContentsUnresponsiveState& unresponsive_state) { | 206 const WebContentsUnresponsiveState& unresponsive_state) { |
| 206 if (logging::DialogsAreSuppressed()) | 207 if (logging::DialogsAreSuppressed()) |
| 207 return; | 208 return; |
| 208 | 209 |
| 209 gfx::NativeWindow window = | 210 gfx::NativeWindow window = gfx::GetTopLevel(contents->GetNativeView()); |
| 210 platform_util::GetTopLevel(contents->GetNativeView()); | |
| 211 #if defined(USE_AURA) | 211 #if defined(USE_AURA) |
| 212 // Don't show the dialog if there is no root window for the renderer, because | 212 // Don't show the dialog if there is no root window for the renderer, because |
| 213 // it's invisible to the user (happens when the renderer is for prerendering | 213 // it's invisible to the user (happens when the renderer is for prerendering |
| 214 // for example). | 214 // for example). |
| 215 if (!window->GetRootWindow()) | 215 if (!window->GetRootWindow()) |
| 216 return; | 216 return; |
| 217 #endif | 217 #endif |
| 218 HungRendererDialogView* view = HungRendererDialogView::Create(window); | 218 HungRendererDialogView* view = HungRendererDialogView::Create(window); |
| 219 view->ShowForWebContents(contents, unresponsive_state); | 219 view->ShowForWebContents(contents, unresponsive_state); |
| 220 } | 220 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 474 |
| 475 // static | 475 // static |
| 476 void HungRendererDialogView::InitClass() { | 476 void HungRendererDialogView::InitClass() { |
| 477 static bool initialized = false; | 477 static bool initialized = false; |
| 478 if (!initialized) { | 478 if (!initialized) { |
| 479 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 479 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 480 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); | 480 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); |
| 481 initialized = true; | 481 initialized = true; |
| 482 } | 482 } |
| 483 } | 483 } |
| OLD | NEW |