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