| 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" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/platform_util.h" | 12 #include "chrome/browser/platform_util.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/harmony/layout_delegate.h" | 17 #include "chrome/browser/ui/views/harmony/chrome_views_layout_delegate.h" |
| 18 #include "chrome/browser/ui/views/layout_utils.h" | 18 #include "chrome/browser/ui/views/layout_utils.h" |
| 19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
| 20 #include "chrome/common/crash_keys.h" | 20 #include "chrome/common/crash_keys.h" |
| 21 #include "chrome/common/logging_chrome.h" | 21 #include "chrome/common/logging_chrome.h" |
| 22 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 23 #include "chrome/grit/theme_resources.h" | 23 #include "chrome/grit/theme_resources.h" |
| 24 #include "components/constrained_window/constrained_window_views.h" | 24 #include "components/constrained_window/constrained_window_views.h" |
| 25 #include "components/favicon/content/content_favicon_driver.h" | 25 #include "components/favicon/content/content_favicon_driver.h" |
| 26 #include "components/web_modal/web_contents_modal_dialog_host.h" | 26 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 27 #include "content/public/browser/render_process_host.h" | 27 #include "content/public/browser/render_process_host.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 std::vector<ui::TableColumn> columns; | 416 std::vector<ui::TableColumn> columns; |
| 417 columns.push_back(ui::TableColumn()); | 417 columns.push_back(ui::TableColumn()); |
| 418 hung_pages_table_ = new views::TableView( | 418 hung_pages_table_ = new views::TableView( |
| 419 hung_pages_table_model_.get(), columns, views::ICON_AND_TEXT, true); | 419 hung_pages_table_model_.get(), columns, views::ICON_AND_TEXT, true); |
| 420 hung_pages_table_->SetGrouper(hung_pages_table_model_.get()); | 420 hung_pages_table_->SetGrouper(hung_pages_table_model_.get()); |
| 421 | 421 |
| 422 using views::GridLayout; | 422 using views::GridLayout; |
| 423 using views::ColumnSet; | 423 using views::ColumnSet; |
| 424 | 424 |
| 425 GridLayout* layout = layout_utils::CreatePanelLayout(this); | 425 GridLayout* layout = layout_utils::CreatePanelLayout(this); |
| 426 LayoutDelegate* delegate = LayoutDelegate::Get(); | 426 ChromeViewsLayoutDelegate* delegate = ChromeViewsLayoutDelegate::Get(); |
| 427 | 427 |
| 428 const int double_column_set_id = 0; | 428 const int double_column_set_id = 0; |
| 429 ColumnSet* column_set = layout->AddColumnSet(double_column_set_id); | 429 ColumnSet* column_set = layout->AddColumnSet(double_column_set_id); |
| 430 column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, | 430 column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, |
| 431 GridLayout::FIXED, frozen_icon_->width(), 0); | 431 GridLayout::FIXED, frozen_icon_->width(), 0); |
| 432 column_set->AddPaddingColumn( | 432 column_set->AddPaddingColumn( |
| 433 0, | 433 0, delegate->GetDistanceMetric( |
| 434 delegate->GetMetric( | 434 ChromeDistanceMetric::UNRELATED_CONTROL_HORIZONTAL_LARGE)); |
| 435 LayoutDelegate::Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING_LARGE)); | |
| 436 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 435 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 437 GridLayout::USE_PREF, 0, 0); | 436 GridLayout::USE_PREF, 0, 0); |
| 438 | 437 |
| 439 layout->StartRow(0, double_column_set_id); | 438 layout->StartRow(0, double_column_set_id); |
| 440 layout->AddView(frozen_icon_view, 1, 3); | 439 layout->AddView(frozen_icon_view, 1, 3); |
| 441 // Add the label with a preferred width of 1, this way it doesn't affect the | 440 // Add the label with a preferred width of 1, this way it doesn't affect the |
| 442 // overall preferred size of the dialog. | 441 // overall preferred size of the dialog. |
| 443 layout->AddView( | 442 layout->AddView( |
| 444 info_label_, 1, 1, GridLayout::FILL, GridLayout::LEADING, 1, 0); | 443 info_label_, 1, 1, GridLayout::FILL, GridLayout::LEADING, 1, 0); |
| 445 | 444 |
| 446 layout->AddPaddingRow( | 445 layout->AddPaddingRow(0, delegate->GetDistanceMetric( |
| 447 0, delegate->GetMetric( | 446 ChromeDistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 448 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 449 | 447 |
| 450 layout->StartRow(1, double_column_set_id); | 448 layout->StartRow(1, double_column_set_id); |
| 451 layout->SkipColumns(1); | 449 layout->SkipColumns(1); |
| 452 layout->AddView(hung_pages_table_->CreateParentIfNecessary(), 1, 1, | 450 layout->AddView(hung_pages_table_->CreateParentIfNecessary(), 1, 1, |
| 453 views::GridLayout::FILL, | 451 views::GridLayout::FILL, |
| 454 views::GridLayout::FILL, kTableViewWidth, kTableViewHeight); | 452 views::GridLayout::FILL, kTableViewWidth, kTableViewHeight); |
| 455 | 453 |
| 456 initialized_ = true; | 454 initialized_ = true; |
| 457 } | 455 } |
| 458 | 456 |
| 459 // static | 457 // static |
| 460 void HungRendererDialogView::InitClass() { | 458 void HungRendererDialogView::InitClass() { |
| 461 static bool initialized = false; | 459 static bool initialized = false; |
| 462 if (!initialized) { | 460 if (!initialized) { |
| 463 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 461 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 464 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); | 462 frozen_icon_ = rb.GetImageSkiaNamed(IDR_FROZEN_TAB_ICON); |
| 465 initialized = true; | 463 initialized = true; |
| 466 } | 464 } |
| 467 } | 465 } |
| OLD | NEW |