Index: chrome/browser/ui/views/session_crashed_bubble_view.cc |
diff --git a/chrome/browser/ui/views/session_crashed_bubble_view.cc b/chrome/browser/ui/views/session_crashed_bubble_view.cc |
index 763ce8afb7417f3711e0adfa40c3e528e2bdde33..f6a539be1609372c16915fe5cf9c75146f844427 100644 |
--- a/chrome/browser/ui/views/session_crashed_bubble_view.cc |
+++ b/chrome/browser/ui/views/session_crashed_bubble_view.cc |
@@ -282,25 +282,40 @@ void SessionCrashedBubbleView::Init() { |
layout->AddView(restore_button_); |
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
+ int buttom_margin = 1; |
msw
2014/08/26 20:19:37
nit: "bottom".
yao
2014/08/27 23:07:03
Done.
|
+ |
// Metrics reporting option. |
if (offer_uma_optin_) { |
- CreateUmaOptinView(layout); |
+ const int kUmaOptionColumnSetId = 2; |
msw
2014/08/26 20:19:37
nit: capitalize UMA here.
yao
2014/08/27 23:07:03
Done.
|
+ cs = layout->AddColumnSet(kUmaOptionColumnSetId); |
+ cs->AddColumn( |
+ GridLayout::FILL, GridLayout::FILL, 1, GridLayout::USE_PREF, 0, 0); |
+ // Add a separator. |
msw
2014/08/26 20:19:37
nit: remove superfluous comment.
yao
2014/08/27 23:07:03
Done.
|
+ layout->StartRow(1, kUmaOptionColumnSetId); |
+ layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
+ // Add the view that lets user opt-in to UMA. |
msw
2014/08/26 20:19:37
nit: remove superfluous comment.
yao
2014/08/27 23:07:02
Done.
|
+ layout->StartRow(1, kUmaOptionColumnSetId); |
+ layout->AddView(CreateUmaOptinView()); |
+ |
+ // Since the uma optin row has a different background than the default |
msw
2014/08/26 20:19:37
nit: capitalize UMA here.
yao
2014/08/27 23:07:03
Done.
|
+ // background color of bubbles, the bottom margin has to be 0 to make sure |
+ // the background extends to the bottom edge of the bubble. |
+ buttom_margin = 0; |
+ |
RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_OPTIN_BAR_SHOWN); |
} |
- set_margins(gfx::Insets()); |
+ set_margins(gfx::Insets(1, 0, buttom_margin, 0)); |
Layout(); |
} |
-void SessionCrashedBubbleView::CreateUmaOptinView(GridLayout* layout) { |
+views::View* SessionCrashedBubbleView::CreateUmaOptinView() { |
// Checkbox for metric reporting setting. |
// Since the text to the right of the checkbox can't be a simple string (needs |
// a hyperlink in it), this checkbox contains an empty string as its label, |
// and the real text will be added as a separate view. |
uma_option_ = new views::Checkbox(base::string16()); |
uma_option_->SetChecked(false); |
- uma_option_->set_background( |
- views::Background::CreateSolidBackground(kBackgroundColor)); |
// The text to the right of the checkbox. |
size_t offset; |
@@ -311,8 +326,6 @@ void SessionCrashedBubbleView::CreateUmaOptinView(GridLayout* layout) { |
link_text, |
&offset); |
views::StyledLabel* uma_label = new views::StyledLabel(uma_text, this); |
- uma_label->set_background( |
- views::Background::CreateSolidBackground(kBackgroundColor)); |
views::StyledLabel::RangeStyleInfo link_style = |
views::StyledLabel::RangeStyleInfo::CreateForLink(); |
link_style.font_style = gfx::Font::NORMAL; |
@@ -327,35 +340,30 @@ void SessionCrashedBubbleView::CreateUmaOptinView(GridLayout* layout) { |
if (!after_link_range.is_empty()) |
uma_label->AddStyleRange(after_link_range, uma_style); |
- // We use a border instead of padding so that the background color reaches |
- // the edges of the bubble. |
- const gfx::Insets title_insets = GetBubbleFrameView()->GetTitleInsets(); |
- uma_option_->SetBorder(views::Border::CreateSolidSidedBorder( |
- 0, title_insets.left(), 0, 0, kBackgroundColor)); |
- uma_label->SetBorder(views::Border::CreateSolidSidedBorder( |
- views::kRelatedControlVerticalSpacing, kCheckboxTextDistance, |
- views::kRelatedControlVerticalSpacing, title_insets.left(), |
- kBackgroundColor)); |
- |
- // Separator. |
- const int kSeparatorColumnSetId = 2; |
- views::ColumnSet* cs = layout->AddColumnSet(kSeparatorColumnSetId); |
- cs->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
- GridLayout::USE_PREF, 0, 0); |
+ // Create a view to hold the checkbox and the text. |
+ views::View* sub_view = new views::View(); |
msw
2014/08/26 20:19:37
optional nit: consider |uma_view| or |optin_view|;
yao
2014/08/27 23:07:03
Done.
|
+ GridLayout* sub_layout = new GridLayout(sub_view); |
+ sub_view->SetLayoutManager(sub_layout); |
+ |
+ sub_view->set_background( |
+ views::Background::CreateSolidBackground(kBackgroundColor)); |
+ int inset_left = GetBubbleFrameView()->GetTitleInsets().left(); |
+ sub_layout->SetInsets(views::kRelatedControlVerticalSpacing, inset_left, |
+ views::kRelatedControlVerticalSpacing, inset_left); |
- // Reporting row. |
- const int kReportColumnSetId = 3; |
- cs = layout->AddColumnSet(kReportColumnSetId); |
- cs->AddColumn(GridLayout::CENTER, GridLayout::FILL, 0, |
+ const int kReportColumnSetId = 0; |
+ views::ColumnSet* cs = sub_layout->AddColumnSet(kReportColumnSetId); |
+ cs->AddColumn(GridLayout::CENTER, GridLayout::LEADING, 0, |
GridLayout::USE_PREF, 0, 0); |
+ cs->AddPaddingColumn(0, kCheckboxTextDistance); |
cs->AddColumn(GridLayout::FILL, GridLayout::FILL, 0, |
GridLayout::FIXED, kWidthOfDescriptionText, 0); |
- layout->StartRow(0, kSeparatorColumnSetId); |
- layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
- layout->StartRow(0, kReportColumnSetId); |
- layout->AddView(uma_option_); |
- layout->AddView(uma_label); |
+ sub_layout->StartRow(0, kReportColumnSetId); |
+ sub_layout->AddView(uma_option_); |
+ sub_layout->AddView(uma_label); |
+ |
+ return sub_view; |
} |
void SessionCrashedBubbleView::ButtonPressed(views::Button* sender, |