| 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/browser_dialogs.h" | 5 #include "chrome/browser/ui/browser_dialogs.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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 views::View* kill_button_container_; | 293 views::View* kill_button_container_; |
| 294 | 294 |
| 295 // The model that provides the contents of the table that shows a list of | 295 // The model that provides the contents of the table that shows a list of |
| 296 // pages affected by the hang. | 296 // pages affected by the hang. |
| 297 scoped_ptr<HungPagesTableModel> hung_pages_table_model_; | 297 scoped_ptr<HungPagesTableModel> hung_pages_table_model_; |
| 298 | 298 |
| 299 // Whether or not we've created controls for ourself. | 299 // Whether or not we've created controls for ourself. |
| 300 bool initialized_; | 300 bool initialized_; |
| 301 | 301 |
| 302 // An amusing icon image. | 302 // An amusing icon image. |
| 303 static SkBitmap* frozen_icon_; | 303 static gfx::ImageSkia* frozen_icon_; |
| 304 | 304 |
| 305 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogView); | 305 DISALLOW_COPY_AND_ASSIGN(HungRendererDialogView); |
| 306 }; | 306 }; |
| 307 | 307 |
| 308 // static | 308 // static |
| 309 SkBitmap* HungRendererDialogView::frozen_icon_ = NULL; | 309 gfx::ImageSkia* HungRendererDialogView::frozen_icon_ = NULL; |
| 310 | 310 |
| 311 // The distance in pixels from the top of the relevant contents to place the | 311 // The distance in pixels from the top of the relevant contents to place the |
| 312 // warning window. | 312 // warning window. |
| 313 static const int kOverlayContentsOffsetY = 50; | 313 static const int kOverlayContentsOffsetY = 50; |
| 314 | 314 |
| 315 // The dimensions of the hung pages list table view, in pixels. | 315 // The dimensions of the hung pages list table view, in pixels. |
| 316 static const int kTableViewWidth = 300; | 316 static const int kTableViewWidth = 300; |
| 317 static const int kTableViewHeight = 100; | 317 static const int kTableViewHeight = 100; |
| 318 | 318 |
| 319 /////////////////////////////////////////////////////////////////////////////// | 319 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 int window_y = contents_bounds.y() + kOverlayContentsOffsetY; | 549 int window_y = contents_bounds.y() + kOverlayContentsOffsetY; |
| 550 return gfx::Rect(window_x, window_y, window_bounds.width(), | 550 return gfx::Rect(window_x, window_y, window_bounds.width(), |
| 551 window_bounds.height()); | 551 window_bounds.height()); |
| 552 } | 552 } |
| 553 | 553 |
| 554 // static | 554 // static |
| 555 void HungRendererDialogView::InitClass() { | 555 void HungRendererDialogView::InitClass() { |
| 556 static bool initialized = false; | 556 static bool initialized = false; |
| 557 if (!initialized) { | 557 if (!initialized) { |
| 558 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 558 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 559 frozen_icon_ = rb.GetBitmapNamed(IDR_FROZEN_TAB_ICON); | 559 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); |
| 560 initialized = true; | 560 initialized = true; |
| 561 } | 561 } |
| 562 } | 562 } |
| 563 | 563 |
| 564 static HungRendererDialogView* CreateHungRendererDialogView() { | 564 static HungRendererDialogView* CreateHungRendererDialogView() { |
| 565 HungRendererDialogView* cv = new HungRendererDialogView; | 565 HungRendererDialogView* cv = new HungRendererDialogView; |
| 566 views::Widget::CreateWindow(cv); | 566 views::Widget::CreateWindow(cv); |
| 567 return cv; | 567 return cv; |
| 568 } | 568 } |
| 569 | 569 |
| 570 namespace browser { | 570 namespace browser { |
| 571 | 571 |
| 572 void ShowHungRendererDialog(WebContents* contents) { | 572 void ShowHungRendererDialog(WebContents* contents) { |
| 573 if (!logging::DialogsAreSuppressed()) { | 573 if (!logging::DialogsAreSuppressed()) { |
| 574 if (!g_instance) | 574 if (!g_instance) |
| 575 g_instance = CreateHungRendererDialogView(); | 575 g_instance = CreateHungRendererDialogView(); |
| 576 g_instance->ShowForWebContents(contents); | 576 g_instance->ShowForWebContents(contents); |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 | 579 |
| 580 void HideHungRendererDialog(WebContents* contents) { | 580 void HideHungRendererDialog(WebContents* contents) { |
| 581 if (!logging::DialogsAreSuppressed() && g_instance) | 581 if (!logging::DialogsAreSuppressed() && g_instance) |
| 582 g_instance->EndForWebContents(contents); | 582 g_instance->EndForWebContents(contents); |
| 583 } | 583 } |
| 584 | 584 |
| 585 } // namespace browser | 585 } // namespace browser |
| OLD | NEW |