| 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 #if defined(OS_WIN) && !defined(USE_AURA) | 7 #if defined(OS_WIN) && !defined(USE_AURA) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 // Padding space in pixels between frozen icon to the info label, hung pages | 185 // Padding space in pixels between frozen icon to the info label, hung pages |
| 186 // list table view and the Kill pages button. | 186 // list table view and the Kill pages button. |
| 187 static const int kCentralColumnPadding = | 187 static const int kCentralColumnPadding = |
| 188 views::kUnrelatedControlLargeHorizontalSpacing; | 188 views::kUnrelatedControlLargeHorizontalSpacing; |
| 189 | 189 |
| 190 /////////////////////////////////////////////////////////////////////////////// | 190 /////////////////////////////////////////////////////////////////////////////// |
| 191 // HungRendererDialogView, public: | 191 // HungRendererDialogView, public: |
| 192 | 192 |
| 193 // static | 193 // static |
| 194 HungRendererDialogView* HungRendererDialogView::Create() { | 194 HungRendererDialogView* HungRendererDialogView::Create( |
| 195 gfx::NativeView context) { |
| 195 if (!g_instance_) { | 196 if (!g_instance_) { |
| 196 g_instance_ = new HungRendererDialogView; | 197 g_instance_ = new HungRendererDialogView; |
| 197 views::Widget::CreateWindow(g_instance_); | 198 views::DialogDelegate::CreateDialogWidget(g_instance_, context, NULL); |
| 198 } | 199 } |
| 199 return g_instance_; | 200 return g_instance_; |
| 200 } | 201 } |
| 201 | 202 |
| 202 // static | 203 // static |
| 203 HungRendererDialogView* HungRendererDialogView::GetInstance() { | 204 HungRendererDialogView* HungRendererDialogView::GetInstance() { |
| 204 return g_instance_; | 205 return g_instance_; |
| 205 } | 206 } |
| 206 | 207 |
| 207 // static | 208 // static |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); | 436 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); |
| 436 initialized = true; | 437 initialized = true; |
| 437 } | 438 } |
| 438 } | 439 } |
| 439 | 440 |
| 440 namespace chrome { | 441 namespace chrome { |
| 441 | 442 |
| 442 void ShowHungRendererDialog(WebContents* contents) { | 443 void ShowHungRendererDialog(WebContents* contents) { |
| 443 if (!logging::DialogsAreSuppressed() && | 444 if (!logging::DialogsAreSuppressed() && |
| 444 !PlatformShowCustomHungRendererDialog(contents)) { | 445 !PlatformShowCustomHungRendererDialog(contents)) { |
| 445 HungRendererDialogView* view = HungRendererDialogView::Create(); | 446 HungRendererDialogView* view = HungRendererDialogView::Create( |
| 447 platform_util::GetTopLevel(contents->GetView()->GetNativeView())); |
| 446 view->ShowForWebContents(contents); | 448 view->ShowForWebContents(contents); |
| 447 } | 449 } |
| 448 } | 450 } |
| 449 | 451 |
| 450 void HideHungRendererDialog(WebContents* contents) { | 452 void HideHungRendererDialog(WebContents* contents) { |
| 451 if (!logging::DialogsAreSuppressed() && | 453 if (!logging::DialogsAreSuppressed() && |
| 452 !PlatformHideCustomHungRendererDialog(contents) && | 454 !PlatformHideCustomHungRendererDialog(contents) && |
| 453 HungRendererDialogView::GetInstance()) | 455 HungRendererDialogView::GetInstance()) |
| 454 HungRendererDialogView::GetInstance()->EndForWebContents(contents); | 456 HungRendererDialogView::GetInstance()->EndForWebContents(contents); |
| 455 } | 457 } |
| 456 | 458 |
| 457 } // namespace chrome | 459 } // namespace chrome |
| OLD | NEW |