Index: chrome/browser/ui/views/autofill/save_card_bubble_views.cc |
diff --git a/chrome/browser/ui/views/autofill/save_card_bubble_views.cc b/chrome/browser/ui/views/autofill/save_card_bubble_views.cc |
index 214f508e7316c2e04f5ea2459ded67a8425f03c9..7605238dd260805478af64d1753713b905b63fef 100644 |
--- a/chrome/browser/ui/views/autofill/save_card_bubble_views.cc |
+++ b/chrome/browser/ui/views/autofill/save_card_bubble_views.cc |
@@ -5,6 +5,7 @@ |
#include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
#include "chrome/browser/ui/autofill/save_card_bubble_controller.h" |
#include "grit/components_strings.h" |
#include "ui/base/l10n/l10n_util.h" |
@@ -12,6 +13,8 @@ |
#include "ui/views/controls/button/blue_button.h" |
#include "ui/views/controls/button/label_button.h" |
#include "ui/views/controls/link.h" |
+#include "ui/views/controls/styled_label.h" |
+#include "ui/views/layout/box_layout.h" |
#include "ui/views/layout/grid_layout.h" |
#include "ui/views/layout/layout_constants.h" |
@@ -95,14 +98,27 @@ void SaveCardBubbleViews::LinkClicked(views::Link* source, int event_flags) { |
controller_->OnLearnMoreClicked(); |
} |
-void SaveCardBubbleViews::Init() { |
+void SaveCardBubbleViews::StyledLabelLinkClicked(const gfx::Range& range, |
+ int event_flags) { |
+ controller_->OnLegalMessageLinkClicked(range); |
+} |
+ |
+// Create view containing everything except for the footnote. |
+// ASCII art diagram of view contents: |
+// +---------------------------------------------------------------------------+ |
+// | | |
+// | learn_more_link_ save_button_ cancel_button_ | |
+// | | |
+// +---------------------------------------------------------------------------+ |
+views::View* SaveCardBubbleViews::CreateMainContentView() { |
enum { |
COLUMN_SET_ID_MESSAGE, |
COLUMN_SET_ID_BUTTONS, |
}; |
- GridLayout* layout = new GridLayout(this); |
- SetLayoutManager(layout); |
+ View* view = new View(); |
+ GridLayout* layout = new GridLayout(view); |
+ view->SetLayoutManager(layout); |
// Set up ColumnSet that will contain the full-width message text. |
int horizontal_inset = GetBubbleFrameView()->GetTitleInsets().left(); |
@@ -151,8 +167,45 @@ void SaveCardBubbleViews::Init() { |
} |
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
+ return view; |
+} |
+ |
+// Create view containing the legal message text. |
+views::View* SaveCardBubbleViews::CreateFootnoteView() { |
+ // Use BoxLayout to provide insets around the label. |
+ View* view = new View(); |
+ int horizontal_inset = GetBubbleFrameView()->GetTitleInsets().left(); |
+ view->SetLayoutManager( |
+ new views::BoxLayout(views::BoxLayout::kHorizontal, horizontal_inset, |
+ views::kRelatedControlVerticalSpacing, 0)); |
+ view->SetBorder( |
+ views::Border::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); |
+ view->set_background( |
+ views::Background::CreateSolidBackground(kLightShadingColor)); |
Evan Stade
2015/11/07 03:03:19
this should probably actually use color_utils::Ble
bondd
2015/11/11 01:53:36
How about I change all of these at once in a follo
Evan Stade
2015/11/11 22:22:54
sure, can you file a bug for it
bondd
2015/11/13 01:19:52
Done. https://code.google.com/p/chromium/issues/de
|
+ |
+ // Create the StyledLabel. |
+ views::StyledLabel* label = |
+ new views::StyledLabel(controller_->GetLegalMessage(), this); |
+ views::StyledLabel::RangeStyleInfo style = |
+ views::StyledLabel::RangeStyleInfo::CreateForLink(); |
Evan Stade
2015/11/07 03:03:19
no need to put this here, you're copying it over a
Justin Donnelly
2015/11/09 16:04:35
The default for CreateForLink in not underlined. (
Evan Stade
2015/11/09 18:59:10
uh, well it's a little different. A standalone lin
bondd
2015/11/11 01:53:36
Done. And I removed the underline from the "Learn
|
+ |
+ // Add all of the label's links. |
+ for (size_t i = 0; i < controller_->GetLegalMessageNumLinks(); ++i) { |
+ label->AddStyleRange(controller_->GetLegalMessageLinkRange(i), style); |
+ } |
+ label->SizeToFit(kWidthOfMessageText); |
+ view->AddChildView(label); |
+ |
+ return view; |
+} |
+ |
+void SaveCardBubbleViews::Init() { |
+ SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
+ AddChildView(CreateMainContentView()); |
+ if (!controller_->GetLegalMessage().empty()) |
+ AddChildView(CreateFootnoteView()); |
+ |
set_margins(gfx::Insets(1, 0, 1, 0)); |
- Layout(); |
} |
} // namespace autofill |