| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" | 12 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" |
| 13 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 13 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/logging_chrome.h" | 16 #include "chrome/common/logging_chrome.h" |
| 17 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 18 #include "components/constrained_window/constrained_window_views.h" | 18 #include "components/constrained_window/constrained_window_views.h" |
| 19 #include "components/favicon/content/content_favicon_driver.h" | 19 #include "components/favicon/content/content_favicon_driver.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/render_widget_host.h" | 23 #include "content/public/browser/render_widget_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/common/result_codes.h" | 25 #include "content/public/common/result_codes.h" |
| 26 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/gfx/canvas.h" | 29 #include "ui/gfx/canvas.h" |
| 30 #include "ui/views/controls/button/label_button.h" | 30 #include "ui/views/controls/button/md_text_button.h" |
| 31 #include "ui/views/controls/image_view.h" | 31 #include "ui/views/controls/image_view.h" |
| 32 #include "ui/views/controls/label.h" | 32 #include "ui/views/controls/label.h" |
| 33 #include "ui/views/layout/grid_layout.h" | 33 #include "ui/views/layout/grid_layout.h" |
| 34 #include "ui/views/layout/layout_constants.h" | 34 #include "ui/views/layout/layout_constants.h" |
| 35 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
| 36 #include "ui/views/window/client_view.h" | 36 #include "ui/views/window/client_view.h" |
| 37 | 37 |
| 38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 39 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" | 39 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" |
| 40 #include "chrome/browser/profiles/profile.h" | 40 #include "chrome/browser/profiles/profile.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 } | 326 } |
| 327 | 327 |
| 328 base::string16 HungRendererDialogView::GetDialogButtonLabel( | 328 base::string16 HungRendererDialogView::GetDialogButtonLabel( |
| 329 ui::DialogButton button) const { | 329 ui::DialogButton button) const { |
| 330 DCHECK_EQ(ui::DIALOG_BUTTON_CANCEL, button); | 330 DCHECK_EQ(ui::DIALOG_BUTTON_CANCEL, button); |
| 331 return l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); | 331 return l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); |
| 332 } | 332 } |
| 333 | 333 |
| 334 views::View* HungRendererDialogView::CreateExtraView() { | 334 views::View* HungRendererDialogView::CreateExtraView() { |
| 335 DCHECK(!kill_button_); | 335 DCHECK(!kill_button_); |
| 336 kill_button_ = new views::LabelButton(this, | 336 kill_button_ = views::MdTextButton::CreateSecondaryUiButton(this, |
| 337 l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_END)); | 337 l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_END)); |
| 338 kill_button_->SetStyle(views::Button::STYLE_BUTTON); | |
| 339 return kill_button_; | 338 return kill_button_; |
| 340 } | 339 } |
| 341 | 340 |
| 342 bool HungRendererDialogView::Cancel() { | 341 bool HungRendererDialogView::Cancel() { |
| 343 // Start waiting again for responsiveness. | 342 // Start waiting again for responsiveness. |
| 344 if (!kill_button_clicked_ && | 343 if (!kill_button_clicked_ && |
| 345 hung_pages_table_model_->GetRenderViewHost()) { | 344 hung_pages_table_model_->GetRenderViewHost()) { |
| 346 hung_pages_table_model_->GetRenderViewHost() | 345 hung_pages_table_model_->GetRenderViewHost() |
| 347 ->GetWidget() | 346 ->GetWidget() |
| 348 ->RestartHangMonitorTimeout(); | 347 ->RestartHangMonitorTimeout(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 447 |
| 449 // static | 448 // static |
| 450 void HungRendererDialogView::InitClass() { | 449 void HungRendererDialogView::InitClass() { |
| 451 static bool initialized = false; | 450 static bool initialized = false; |
| 452 if (!initialized) { | 451 if (!initialized) { |
| 453 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 452 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 454 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); | 453 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); |
| 455 initialized = true; | 454 initialized = true; |
| 456 } | 455 } |
| 457 } | 456 } |
| OLD | NEW |