Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Unified Diff: chrome/browser/ui/views/hung_renderer_view.cc

Issue 2660553005: Harmony - convert hung renderer dialog. (Closed)
Patch Set: comments 1 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/hung_renderer_view.cc
diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index 94bfedc9f3a3634a9b0c4a28c8ffee58191b8777..66e9e0f29bf94a0543485035d5db079e882fd4df 100644
--- a/chrome/browser/ui/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
@@ -14,6 +14,8 @@
#include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
+#include "chrome/browser/ui/views/harmony/layout_delegate.h"
+#include "chrome/browser/ui/views/layout_utils.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/crash_keys.h"
#include "chrome/common/logging_chrome.h"
@@ -34,7 +36,6 @@
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/grid_layout.h"
-#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/client_view.h"
@@ -176,11 +177,6 @@ gfx::ImageSkia* HungRendererDialogView::frozen_icon_ = NULL;
static const int kTableViewWidth = 300;
static const int kTableViewHeight = 100;
-// Padding space in pixels between frozen icon to the info label, hung pages
-// list table view and the Kill pages button.
-static const int kCentralColumnPadding =
- views::kUnrelatedControlLargeHorizontalSpacing;
-
///////////////////////////////////////////////////////////////////////////////
// HungRendererDialogView, public:
@@ -347,9 +343,20 @@ views::View* HungRendererDialogView::CreateExtraView() {
DCHECK(!kill_button_);
kill_button_ = views::MdTextButton::CreateSecondaryUiButton(this,
l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_END));
+ LayoutDelegate* delegate = LayoutDelegate::Get();
+ // The kill button doesn't look like a normal dialog button pre-harmony.
Peter Kasting 2017/02/02 00:32:30 Oh? It looks like one in my build. Say more? Wh
Bret 2017/02/03 01:47:17 I meant that it's an extra view, off to the left,
+ if (delegate->IsHarmonyMode())
+ kill_button_->SetMinSize(
+ gfx::Size(delegate->GetDialogButtonMinimumWidth(), 0));
return kill_button_;
}
+bool HungRendererDialogView::GroupExtraViewWithButtons() const {
+ // In harmony the kill button looks like a dialog button, but still doesn't
+ // respond to accelerator keys, so it remains an extra view.
Peter Kasting 2017/02/02 00:32:30 Why doesn't it respond to accelerator keys? Are w
Bret 2017/02/03 01:47:17 I dunno, that's the only reason I can think of tha
+ return LayoutDelegate::Get()->IsHarmonyMode();
+}
+
bool HungRendererDialogView::Cancel() {
// Start waiting again for responsiveness.
if (!kill_button_clicked_ &&
@@ -443,14 +450,17 @@ void HungRendererDialogView::Init() {
using views::GridLayout;
using views::ColumnSet;
- GridLayout* layout = GridLayout::CreatePanel(this);
- SetLayoutManager(layout);
+ GridLayout* layout = layout_utils::CreatePanelLayout(this);
+ LayoutDelegate* delegate = LayoutDelegate::Get();
const int double_column_set_id = 0;
ColumnSet* column_set = layout->AddColumnSet(double_column_set_id);
column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0,
GridLayout::FIXED, frozen_icon_->width(), 0);
- column_set->AddPaddingColumn(0, kCentralColumnPadding);
+ column_set->AddPaddingColumn(
+ 0, delegate->GetLayoutDistance(
+ LayoutDelegate::LayoutDistanceType::
+ UNRELATED_CONTROL_LARGE_HORIZONTAL_SPACING));
column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
GridLayout::USE_PREF, 0, 0);
@@ -461,7 +471,9 @@ void HungRendererDialogView::Init() {
layout->AddView(
info_label_, 1, 1, GridLayout::FILL, GridLayout::LEADING, 1, 0);
- layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+ layout->AddPaddingRow(
+ 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
+ RELATED_CONTROL_VERTICAL_SPACING));
layout->StartRow(0, double_column_set_id);
layout->SkipColumns(1);

Powered by Google App Engine
This is Rietveld 408576698