| 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/autofill/autofill_dialog_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Horizontal padding between text and other elements (in pixels). | 72 // Horizontal padding between text and other elements (in pixels). |
| 73 const int kAroundTextPadding = 4; | 73 const int kAroundTextPadding = 4; |
| 74 | 74 |
| 75 // The space between the edges of a notification bar and the text within (in | 75 // The space between the edges of a notification bar and the text within (in |
| 76 // pixels). | 76 // pixels). |
| 77 const int kNotificationPadding = 17; | 77 const int kNotificationPadding = 17; |
| 78 | 78 |
| 79 // Vertical padding above and below each detail section (in pixels). | 79 // Vertical padding above and below each detail section (in pixels). |
| 80 const int kDetailSectionVerticalPadding = 10; | 80 const int kDetailSectionVerticalPadding = 10; |
| 81 | 81 |
| 82 const int kAutocheckoutStepsAreaPadding = 28; | |
| 83 const int kAutocheckoutStepInset = 20; | |
| 84 | |
| 85 const int kAutocheckoutProgressBarWidth = 375; | |
| 86 const int kAutocheckoutProgressBarHeight = 15; | |
| 87 | |
| 88 const int kArrowHeight = 7; | 82 const int kArrowHeight = 7; |
| 89 const int kArrowWidth = 2 * kArrowHeight; | 83 const int kArrowWidth = 2 * kArrowHeight; |
| 90 | 84 |
| 91 // The padding inside the edges of the dialog, in pixels. | 85 // The padding inside the edges of the dialog, in pixels. |
| 92 const int kDialogEdgePadding = 20; | 86 const int kDialogEdgePadding = 20; |
| 93 | 87 |
| 94 // Slight shading for mouse hover and legal document background. | 88 // Slight shading for mouse hover and legal document background. |
| 95 SkColor kShadingColor = SkColorSetARGB(7, 0, 0, 0); | 89 SkColor kShadingColor = SkColorSetARGB(7, 0, 0, 0); |
| 96 | 90 |
| 97 // A border color for the legal document view. | 91 // A border color for the legal document view. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 PreferredSizeChanged(); | 260 PreferredSizeChanged(); |
| 267 } | 261 } |
| 268 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE { | 262 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE { |
| 269 PreferredSizeChanged(); | 263 PreferredSizeChanged(); |
| 270 } | 264 } |
| 271 | 265 |
| 272 private: | 266 private: |
| 273 DISALLOW_COPY_AND_ASSIGN(LayoutPropagationView); | 267 DISALLOW_COPY_AND_ASSIGN(LayoutPropagationView); |
| 274 }; | 268 }; |
| 275 | 269 |
| 276 // A class which displays the status of an individual step in an | |
| 277 // Autocheckout flow. | |
| 278 class AutocheckoutStepProgressView : public views::View { | |
| 279 public: | |
| 280 AutocheckoutStepProgressView(const base::string16& description, | |
| 281 const gfx::Font& font, | |
| 282 const SkColor color, | |
| 283 const bool is_icon_visible) { | |
| 284 views::GridLayout* layout = new views::GridLayout(this); | |
| 285 SetLayoutManager(layout); | |
| 286 const int kColumnSetId = 0; | |
| 287 views::ColumnSet* columns = layout->AddColumnSet(kColumnSetId); | |
| 288 columns->AddColumn(views::GridLayout::LEADING, | |
| 289 views::GridLayout::CENTER, | |
| 290 0, | |
| 291 views::GridLayout::USE_PREF, | |
| 292 0, | |
| 293 0); | |
| 294 columns->AddPaddingColumn(0, 8); | |
| 295 columns->AddColumn(views::GridLayout::LEADING, | |
| 296 views::GridLayout::CENTER, | |
| 297 0, | |
| 298 views::GridLayout::USE_PREF, | |
| 299 0, | |
| 300 0); | |
| 301 layout->StartRow(0, kColumnSetId); | |
| 302 views::Label* label = new views::Label(); | |
| 303 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | |
| 304 label->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 0)); | |
| 305 label->SetText(description); | |
| 306 label->SetFont(font); | |
| 307 label->SetEnabledColor(color); | |
| 308 | |
| 309 views::ImageView* icon = new views::ImageView(); | |
| 310 icon->SetVisible(is_icon_visible); | |
| 311 icon->SetImage(ui::ResourceBundle::GetSharedInstance().GetImageNamed( | |
| 312 IDR_WALLET_STEP_CHECK).ToImageSkia()); | |
| 313 | |
| 314 layout->AddView(icon); | |
| 315 layout->AddView(label); | |
| 316 } | |
| 317 | |
| 318 virtual ~AutocheckoutStepProgressView() {} | |
| 319 | |
| 320 private: | |
| 321 DISALLOW_COPY_AND_ASSIGN(AutocheckoutStepProgressView); | |
| 322 }; | |
| 323 | |
| 324 // A tooltip icon (just an ImageView with a tooltip). Looks like (?). | 270 // A tooltip icon (just an ImageView with a tooltip). Looks like (?). |
| 325 class TooltipIcon : public views::ImageView { | 271 class TooltipIcon : public views::ImageView { |
| 326 public: | 272 public: |
| 327 explicit TooltipIcon(const base::string16& tooltip) : tooltip_(tooltip) { | 273 explicit TooltipIcon(const base::string16& tooltip) : tooltip_(tooltip) { |
| 328 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 274 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 329 IDR_AUTOFILL_TOOLTIP_ICON).ToImageSkia()); | 275 IDR_AUTOFILL_TOOLTIP_ICON).ToImageSkia()); |
| 330 } | 276 } |
| 331 virtual ~TooltipIcon() {} | 277 virtual ~TooltipIcon() {} |
| 332 | 278 |
| 333 // views::View implementation | 279 // views::View implementation |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 } | 1077 } |
| 1132 | 1078 |
| 1133 void AutofillDialogViews::SuggestionView::SetTextfield( | 1079 void AutofillDialogViews::SuggestionView::SetTextfield( |
| 1134 const base::string16& placeholder_text, | 1080 const base::string16& placeholder_text, |
| 1135 const gfx::Image& icon) { | 1081 const gfx::Image& icon) { |
| 1136 decorated_->set_placeholder_text(placeholder_text); | 1082 decorated_->set_placeholder_text(placeholder_text); |
| 1137 decorated_->SetIcon(icon); | 1083 decorated_->SetIcon(icon); |
| 1138 decorated_->SetVisible(!placeholder_text.empty()); | 1084 decorated_->SetVisible(!placeholder_text.empty()); |
| 1139 } | 1085 } |
| 1140 | 1086 |
| 1141 // AutofillDialogViews::AutocheckoutStepsArea --------------------------------- | |
| 1142 | |
| 1143 AutofillDialogViews::AutocheckoutStepsArea::AutocheckoutStepsArea() { | |
| 1144 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, | |
| 1145 kAutocheckoutStepsAreaPadding, | |
| 1146 0, | |
| 1147 kAutocheckoutStepInset)); | |
| 1148 } | |
| 1149 | |
| 1150 void AutofillDialogViews::AutocheckoutStepsArea::SetSteps( | |
| 1151 const std::vector<DialogAutocheckoutStep>& steps) { | |
| 1152 RemoveAllChildViews(true); | |
| 1153 for (size_t i = 0; i < steps.size(); ++i) { | |
| 1154 const DialogAutocheckoutStep& step = steps[i]; | |
| 1155 AutocheckoutStepProgressView* progressView = | |
| 1156 new AutocheckoutStepProgressView(step.GetDisplayText(), | |
| 1157 step.GetTextFont(), | |
| 1158 step.GetTextColor(), | |
| 1159 step.IsIconVisible()); | |
| 1160 | |
| 1161 AddChildView(progressView); | |
| 1162 } | |
| 1163 | |
| 1164 PreferredSizeChanged(); | |
| 1165 } | |
| 1166 | |
| 1167 // AutofillDialogViews::AutocheckoutProgressBar | |
| 1168 | |
| 1169 AutofillDialogViews::AutocheckoutProgressBar::AutocheckoutProgressBar() {} | |
| 1170 AutofillDialogViews::AutocheckoutProgressBar::~AutocheckoutProgressBar() {} | |
| 1171 | |
| 1172 gfx::Size AutofillDialogViews::AutocheckoutProgressBar::GetPreferredSize() { | |
| 1173 return gfx::Size(kAutocheckoutProgressBarWidth, | |
| 1174 kAutocheckoutProgressBarHeight); | |
| 1175 } | |
| 1176 | |
| 1177 // AutofillDialogView ---------------------------------------------------------- | 1087 // AutofillDialogView ---------------------------------------------------------- |
| 1178 | 1088 |
| 1179 // static | 1089 // static |
| 1180 AutofillDialogView* AutofillDialogView::Create( | 1090 AutofillDialogView* AutofillDialogView::Create( |
| 1181 AutofillDialogViewDelegate* delegate) { | 1091 AutofillDialogViewDelegate* delegate) { |
| 1182 return new AutofillDialogViews(delegate); | 1092 return new AutofillDialogViews(delegate); |
| 1183 } | 1093 } |
| 1184 | 1094 |
| 1185 // AutofillDialogViews --------------------------------------------------------- | 1095 // AutofillDialogViews --------------------------------------------------------- |
| 1186 | 1096 |
| 1187 AutofillDialogViews::AutofillDialogViews(AutofillDialogViewDelegate* delegate) | 1097 AutofillDialogViews::AutofillDialogViews(AutofillDialogViewDelegate* delegate) |
| 1188 : delegate_(delegate), | 1098 : delegate_(delegate), |
| 1189 updates_scope_(0), | 1099 updates_scope_(0), |
| 1190 needs_update_(false), | 1100 needs_update_(false), |
| 1191 window_(NULL), | 1101 window_(NULL), |
| 1192 browser_resize_timer_(false, false), | 1102 browser_resize_timer_(false, false), |
| 1193 notification_area_(NULL), | 1103 notification_area_(NULL), |
| 1194 account_chooser_(NULL), | 1104 account_chooser_(NULL), |
| 1195 sign_in_webview_(NULL), | 1105 sign_in_webview_(NULL), |
| 1196 scrollable_area_(NULL), | 1106 scrollable_area_(NULL), |
| 1197 details_container_(NULL), | 1107 details_container_(NULL), |
| 1198 loading_shield_(NULL), | 1108 loading_shield_(NULL), |
| 1199 overlay_view_(NULL), | 1109 overlay_view_(NULL), |
| 1200 button_strip_extra_view_(NULL), | 1110 button_strip_extra_view_(NULL), |
| 1201 save_in_chrome_checkbox_(NULL), | 1111 save_in_chrome_checkbox_(NULL), |
| 1202 save_in_chrome_checkbox_container_(NULL), | 1112 save_in_chrome_checkbox_container_(NULL), |
| 1203 button_strip_image_(NULL), | 1113 button_strip_image_(NULL), |
| 1204 autocheckout_steps_area_(NULL), | |
| 1205 autocheckout_progress_bar_view_(NULL), | |
| 1206 autocheckout_progress_bar_(NULL), | |
| 1207 footnote_view_(NULL), | 1114 footnote_view_(NULL), |
| 1208 legal_document_view_(NULL), | 1115 legal_document_view_(NULL), |
| 1209 focus_manager_(NULL), | 1116 focus_manager_(NULL), |
| 1210 observer_(this) { | 1117 observer_(this) { |
| 1211 DCHECK(delegate); | 1118 DCHECK(delegate); |
| 1212 detail_groups_.insert(std::make_pair(SECTION_EMAIL, | 1119 detail_groups_.insert(std::make_pair(SECTION_EMAIL, |
| 1213 DetailsGroup(SECTION_EMAIL))); | 1120 DetailsGroup(SECTION_EMAIL))); |
| 1214 detail_groups_.insert(std::make_pair(SECTION_CC, | 1121 detail_groups_.insert(std::make_pair(SECTION_CC, |
| 1215 DetailsGroup(SECTION_CC))); | 1122 DetailsGroup(SECTION_CC))); |
| 1216 detail_groups_.insert(std::make_pair(SECTION_BILLING, | 1123 detail_groups_.insert(std::make_pair(SECTION_BILLING, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 link_ranges[i], | 1213 link_ranges[i], |
| 1307 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 1214 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 1308 } | 1215 } |
| 1309 } | 1216 } |
| 1310 | 1217 |
| 1311 footnote_view_->SetVisible(!text.empty()); | 1218 footnote_view_->SetVisible(!text.empty()); |
| 1312 ContentsPreferredSizeChanged(); | 1219 ContentsPreferredSizeChanged(); |
| 1313 } | 1220 } |
| 1314 } | 1221 } |
| 1315 | 1222 |
| 1316 void AutofillDialogViews::UpdateAutocheckoutStepsArea() { | |
| 1317 autocheckout_steps_area_->SetSteps(delegate_->CurrentAutocheckoutSteps()); | |
| 1318 ContentsPreferredSizeChanged(); | |
| 1319 } | |
| 1320 | |
| 1321 void AutofillDialogViews::UpdateButtonStrip() { | 1223 void AutofillDialogViews::UpdateButtonStrip() { |
| 1322 button_strip_extra_view_->SetVisible( | 1224 button_strip_extra_view_->SetVisible( |
| 1323 GetDialogButtons() != ui::DIALOG_BUTTON_NONE); | 1225 GetDialogButtons() != ui::DIALOG_BUTTON_NONE); |
| 1324 UpdateButtonStripExtraView(); | 1226 UpdateButtonStripExtraView(); |
| 1325 GetDialogClientView()->UpdateDialogButtons(); | 1227 GetDialogClientView()->UpdateDialogButtons(); |
| 1326 | 1228 |
| 1327 overlay_view_->SetState(delegate_->GetDialogOverlay(), this); | 1229 overlay_view_->SetState(delegate_->GetDialogOverlay(), this); |
| 1328 | 1230 |
| 1329 ContentsPreferredSizeChanged(); | 1231 ContentsPreferredSizeChanged(); |
| 1330 } | 1232 } |
| 1331 | 1233 |
| 1332 void AutofillDialogViews::UpdateDetailArea() { | 1234 void AutofillDialogViews::UpdateDetailArea() { |
| 1333 scrollable_area_->SetVisible(delegate_->ShouldShowDetailArea()); | 1235 scrollable_area_->SetVisible(true); |
| 1334 ContentsPreferredSizeChanged(); | 1236 ContentsPreferredSizeChanged(); |
| 1335 } | 1237 } |
| 1336 | 1238 |
| 1337 void AutofillDialogViews::UpdateForErrors() { | 1239 void AutofillDialogViews::UpdateForErrors() { |
| 1338 ValidateForm(); | 1240 ValidateForm(); |
| 1339 } | 1241 } |
| 1340 | 1242 |
| 1341 void AutofillDialogViews::UpdateNotificationArea() { | 1243 void AutofillDialogViews::UpdateNotificationArea() { |
| 1342 DCHECK(notification_area_); | 1244 DCHECK(notification_area_); |
| 1343 notification_area_->SetNotifications(delegate_->CurrentNotifications()); | 1245 notification_area_->SetNotifications(delegate_->CurrentNotifications()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 ContentsPreferredSizeChanged(); | 1312 ContentsPreferredSizeChanged(); |
| 1411 return &sign_in_webview_->web_contents()->GetController(); | 1313 return &sign_in_webview_->web_contents()->GetController(); |
| 1412 } | 1314 } |
| 1413 | 1315 |
| 1414 void AutofillDialogViews::HideSignIn() { | 1316 void AutofillDialogViews::HideSignIn() { |
| 1415 sign_in_webview_->SetVisible(false); | 1317 sign_in_webview_->SetVisible(false); |
| 1416 UpdateButtonStrip(); | 1318 UpdateButtonStrip(); |
| 1417 ContentsPreferredSizeChanged(); | 1319 ContentsPreferredSizeChanged(); |
| 1418 } | 1320 } |
| 1419 | 1321 |
| 1420 void AutofillDialogViews::UpdateProgressBar(double value) { | |
| 1421 autocheckout_progress_bar_->SetValue(value); | |
| 1422 } | |
| 1423 | |
| 1424 void AutofillDialogViews::ModelChanged() { | 1322 void AutofillDialogViews::ModelChanged() { |
| 1425 menu_runner_.reset(); | 1323 menu_runner_.reset(); |
| 1426 | 1324 |
| 1427 for (DetailGroupMap::const_iterator iter = detail_groups_.begin(); | 1325 for (DetailGroupMap::const_iterator iter = detail_groups_.begin(); |
| 1428 iter != detail_groups_.end(); ++iter) { | 1326 iter != detail_groups_.end(); ++iter) { |
| 1429 UpdateDetailsGroupState(iter->second); | 1327 UpdateDetailsGroupState(iter->second); |
| 1430 } | 1328 } |
| 1431 } | 1329 } |
| 1432 | 1330 |
| 1433 TestableAutofillDialogView* AutofillDialogViews::GetTestableView() { | 1331 TestableAutofillDialogView* AutofillDialogViews::GetTestableView() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 return; | 1413 return; |
| 1516 } | 1414 } |
| 1517 | 1415 |
| 1518 const int x = content_bounds.x(); | 1416 const int x = content_bounds.x(); |
| 1519 const int y = content_bounds.y(); | 1417 const int y = content_bounds.y(); |
| 1520 const int width = content_bounds.width(); | 1418 const int width = content_bounds.width(); |
| 1521 // Layout notification area at top of dialog. | 1419 // Layout notification area at top of dialog. |
| 1522 int notification_height = notification_area_->GetHeightForWidth(width); | 1420 int notification_height = notification_area_->GetHeightForWidth(width); |
| 1523 notification_area_->SetBounds(x, y, width, notification_height); | 1421 notification_area_->SetBounds(x, y, width, notification_height); |
| 1524 | 1422 |
| 1525 // Layout Autocheckout steps at bottom of dialog. | |
| 1526 int steps_height = autocheckout_steps_area_->GetHeightForWidth(width); | |
| 1527 autocheckout_steps_area_->SetBounds(x, content_bounds.bottom() - steps_height, | |
| 1528 width, steps_height); | |
| 1529 | |
| 1530 // The rest (the |scrollable_area_|) takes up whatever's left. | 1423 // The rest (the |scrollable_area_|) takes up whatever's left. |
| 1531 if (scrollable_area_->visible()) { | 1424 if (scrollable_area_->visible()) { |
| 1532 int scroll_y = y; | 1425 int scroll_y = y; |
| 1533 if (notification_height > 0) | 1426 if (notification_height > 0) |
| 1534 scroll_y += notification_height + views::kRelatedControlVerticalSpacing; | 1427 scroll_y += notification_height + views::kRelatedControlVerticalSpacing; |
| 1535 | 1428 |
| 1536 int scroll_bottom = content_bounds.bottom(); | 1429 int scroll_bottom = content_bounds.bottom(); |
| 1537 if (steps_height > 0) | |
| 1538 scroll_bottom -= steps_height + views::kRelatedControlVerticalSpacing; | |
| 1539 | |
| 1540 scrollable_area_->contents()->SizeToPreferredSize(); | 1430 scrollable_area_->contents()->SizeToPreferredSize(); |
| 1541 scrollable_area_->SetBounds(x, scroll_y, width, scroll_bottom - scroll_y); | 1431 scrollable_area_->SetBounds(x, scroll_y, width, scroll_bottom - scroll_y); |
| 1542 } | 1432 } |
| 1543 | 1433 |
| 1544 if (loading_shield_->visible()) | 1434 if (loading_shield_->visible()) |
| 1545 loading_shield_->SetBoundsRect(bounds()); | 1435 loading_shield_->SetBoundsRect(bounds()); |
| 1546 | 1436 |
| 1547 if (error_bubble_) | 1437 if (error_bubble_) |
| 1548 error_bubble_->UpdatePosition(); | 1438 error_bubble_->UpdatePosition(); |
| 1549 } | 1439 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 int height = overlay_view_->GetHeightForContentsForWidth(width); | 1653 int height = overlay_view_->GetHeightForContentsForWidth(width); |
| 1764 if (height != 0) | 1654 if (height != 0) |
| 1765 return gfx::Size(width + insets.width(), height + insets.height()); | 1655 return gfx::Size(width + insets.width(), height + insets.height()); |
| 1766 } | 1656 } |
| 1767 | 1657 |
| 1768 int height = 0; | 1658 int height = 0; |
| 1769 int notification_height = notification_area_->GetHeightForWidth(width); | 1659 int notification_height = notification_area_->GetHeightForWidth(width); |
| 1770 if (notification_height > 0) | 1660 if (notification_height > 0) |
| 1771 height += notification_height + views::kRelatedControlVerticalSpacing; | 1661 height += notification_height + views::kRelatedControlVerticalSpacing; |
| 1772 | 1662 |
| 1773 int steps_height = autocheckout_steps_area_->GetHeightForWidth(width); | |
| 1774 if (steps_height > 0) | |
| 1775 height += steps_height + views::kRelatedControlVerticalSpacing; | |
| 1776 | |
| 1777 if (scrollable_area_->visible()) { | 1663 if (scrollable_area_->visible()) { |
| 1778 // Show as much of the scroll view as is possible without going past the | 1664 // Show as much of the scroll view as is possible without going past the |
| 1779 // bottom of the browser window. | 1665 // bottom of the browser window. |
| 1780 views::Widget* widget = | 1666 views::Widget* widget = |
| 1781 views::Widget::GetTopLevelWidgetForNativeView( | 1667 views::Widget::GetTopLevelWidgetForNativeView( |
| 1782 delegate_->GetWebContents()->GetView()->GetNativeView()); | 1668 delegate_->GetWebContents()->GetView()->GetNativeView()); |
| 1783 int browser_window_height = | 1669 int browser_window_height = |
| 1784 widget ? widget->GetContentsView()->bounds().height() : INT_MAX; | 1670 widget ? widget->GetContentsView()->bounds().height() : INT_MAX; |
| 1785 const int kWindowDecorationHeight = 200; | 1671 const int kWindowDecorationHeight = 200; |
| 1786 int browser_constrained_height = | 1672 int browser_constrained_height = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1809 new views::Checkbox(delegate_->SaveLocallyText()); | 1695 new views::Checkbox(delegate_->SaveLocallyText()); |
| 1810 save_in_chrome_checkbox_->SetChecked(true); | 1696 save_in_chrome_checkbox_->SetChecked(true); |
| 1811 save_in_chrome_checkbox_container_->AddChildView(save_in_chrome_checkbox_); | 1697 save_in_chrome_checkbox_container_->AddChildView(save_in_chrome_checkbox_); |
| 1812 | 1698 |
| 1813 save_in_chrome_checkbox_container_->AddChildView( | 1699 save_in_chrome_checkbox_container_->AddChildView( |
| 1814 new TooltipIcon(delegate_->SaveLocallyTooltip())); | 1700 new TooltipIcon(delegate_->SaveLocallyTooltip())); |
| 1815 | 1701 |
| 1816 button_strip_image_ = new views::ImageView(); | 1702 button_strip_image_ = new views::ImageView(); |
| 1817 button_strip_extra_view_->AddChildView(button_strip_image_); | 1703 button_strip_extra_view_->AddChildView(button_strip_image_); |
| 1818 | 1704 |
| 1819 autocheckout_progress_bar_view_ = new views::View(); | |
| 1820 views::GridLayout* progress_bar_layout = | |
| 1821 new views::GridLayout(autocheckout_progress_bar_view_); | |
| 1822 autocheckout_progress_bar_view_->SetLayoutManager(progress_bar_layout); | |
| 1823 const int kColumnSetId = 0; | |
| 1824 views::ColumnSet* columns = progress_bar_layout->AddColumnSet(kColumnSetId); | |
| 1825 columns->AddColumn(views::GridLayout::LEADING, | |
| 1826 views::GridLayout::CENTER, | |
| 1827 0, | |
| 1828 views::GridLayout::USE_PREF, | |
| 1829 0, | |
| 1830 0); | |
| 1831 progress_bar_layout->StartRow(1.0, kColumnSetId); | |
| 1832 | |
| 1833 autocheckout_progress_bar_ = new AutocheckoutProgressBar(); | |
| 1834 progress_bar_layout->AddView(autocheckout_progress_bar_); | |
| 1835 button_strip_extra_view_->AddChildView(autocheckout_progress_bar_view_); | |
| 1836 | |
| 1837 account_chooser_ = new AccountChooser(delegate_); | 1705 account_chooser_ = new AccountChooser(delegate_); |
| 1838 notification_area_ = new NotificationArea(delegate_); | 1706 notification_area_ = new NotificationArea(delegate_); |
| 1839 notification_area_->set_arrow_centering_anchor(account_chooser_->AsWeakPtr()); | 1707 notification_area_->set_arrow_centering_anchor(account_chooser_->AsWeakPtr()); |
| 1840 AddChildView(notification_area_); | 1708 AddChildView(notification_area_); |
| 1841 | 1709 |
| 1842 scrollable_area_ = new views::ScrollView(); | 1710 scrollable_area_ = new views::ScrollView(); |
| 1843 scrollable_area_->set_hide_horizontal_scrollbar(true); | 1711 scrollable_area_->set_hide_horizontal_scrollbar(true); |
| 1844 scrollable_area_->SetContents(CreateDetailsContainer()); | 1712 scrollable_area_->SetContents(CreateDetailsContainer()); |
| 1845 AddChildView(scrollable_area_); | 1713 AddChildView(scrollable_area_); |
| 1846 | 1714 |
| 1847 autocheckout_steps_area_ = new AutocheckoutStepsArea(); | |
| 1848 AddChildView(autocheckout_steps_area_); | |
| 1849 | |
| 1850 loading_shield_ = new views::Label(); | 1715 loading_shield_ = new views::Label(); |
| 1851 loading_shield_->SetVisible(false); | 1716 loading_shield_->SetVisible(false); |
| 1852 loading_shield_->set_background(views::Background::CreateSolidBackground( | 1717 loading_shield_->set_background(views::Background::CreateSolidBackground( |
| 1853 GetNativeTheme()->GetSystemColor( | 1718 GetNativeTheme()->GetSystemColor( |
| 1854 ui::NativeTheme::kColorId_DialogBackground))); | 1719 ui::NativeTheme::kColorId_DialogBackground))); |
| 1855 loading_shield_->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( | 1720 loading_shield_->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( |
| 1856 ui::ResourceBundle::BaseFont).DeriveFont(15)); | 1721 ui::ResourceBundle::BaseFont).DeriveFont(15)); |
| 1857 AddChildView(loading_shield_); | 1722 AddChildView(loading_shield_); |
| 1858 | 1723 |
| 1859 sign_in_webview_ = new views::WebView(delegate_->profile()); | 1724 sign_in_webview_ = new views::WebView(delegate_->profile()); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 decorated->SetIcon(icon); | 2151 decorated->SetIcon(icon); |
| 2287 } | 2152 } |
| 2288 | 2153 |
| 2289 void AutofillDialogViews::UpdateButtonStripExtraView() { | 2154 void AutofillDialogViews::UpdateButtonStripExtraView() { |
| 2290 save_in_chrome_checkbox_container_->SetVisible( | 2155 save_in_chrome_checkbox_container_->SetVisible( |
| 2291 delegate_->ShouldOfferToSaveInChrome()); | 2156 delegate_->ShouldOfferToSaveInChrome()); |
| 2292 | 2157 |
| 2293 gfx::Image image = delegate_->ButtonStripImage(); | 2158 gfx::Image image = delegate_->ButtonStripImage(); |
| 2294 button_strip_image_->SetVisible(!image.IsEmpty()); | 2159 button_strip_image_->SetVisible(!image.IsEmpty()); |
| 2295 button_strip_image_->SetImage(image.AsImageSkia()); | 2160 button_strip_image_->SetImage(image.AsImageSkia()); |
| 2296 | |
| 2297 autocheckout_progress_bar_view_->SetVisible( | |
| 2298 delegate_->ShouldShowProgressBar()); | |
| 2299 } | 2161 } |
| 2300 | 2162 |
| 2301 void AutofillDialogViews::ContentsPreferredSizeChanged() { | 2163 void AutofillDialogViews::ContentsPreferredSizeChanged() { |
| 2302 if (updates_scope_ != 0) { | 2164 if (updates_scope_ != 0) { |
| 2303 needs_update_ = true; | 2165 needs_update_ = true; |
| 2304 return; | 2166 return; |
| 2305 } | 2167 } |
| 2306 | 2168 |
| 2307 preferred_size_ = gfx::Size(); | 2169 preferred_size_ = gfx::Size(); |
| 2308 | 2170 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 2239 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
| 2378 : section(section), | 2240 : section(section), |
| 2379 container(NULL), | 2241 container(NULL), |
| 2380 manual_input(NULL), | 2242 manual_input(NULL), |
| 2381 suggested_info(NULL), | 2243 suggested_info(NULL), |
| 2382 suggested_button(NULL) {} | 2244 suggested_button(NULL) {} |
| 2383 | 2245 |
| 2384 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 2246 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
| 2385 | 2247 |
| 2386 } // namespace autofill | 2248 } // namespace autofill |
| OLD | NEW |