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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE { | 304 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE { |
305 bounds_changed_callback_.Run(); | 305 bounds_changed_callback_.Run(); |
306 } | 306 } |
307 | 307 |
308 private: | 308 private: |
309 base::Closure bounds_changed_callback_; | 309 base::Closure bounds_changed_callback_; |
310 | 310 |
311 DISALLOW_COPY_AND_ASSIGN(DetailsContainerView); | 311 DISALLOW_COPY_AND_ASSIGN(DetailsContainerView); |
312 }; | 312 }; |
313 | 313 |
314 // ButtonStripView wraps the Autocheckout progress bar and the "[X] Save details | 314 // A view that propagates visibility and preferred size changes. |
315 // in Chrome" checkbox and listens for visibility changes. | 315 class LayoutPropagationView : public views::View { |
316 class ButtonStripView : public views::View { | |
317 public: | 316 public: |
318 ButtonStripView() {} | 317 LayoutPropagationView() {} |
319 virtual ~ButtonStripView() {} | 318 virtual ~LayoutPropagationView() {} |
320 | 319 |
321 protected: | 320 protected: |
322 virtual void ChildVisibilityChanged(views::View* child) OVERRIDE { | 321 virtual void ChildVisibilityChanged(views::View* child) OVERRIDE { |
323 PreferredSizeChanged(); | 322 PreferredSizeChanged(); |
324 } | 323 } |
| 324 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE { |
| 325 PreferredSizeChanged(); |
| 326 } |
325 | 327 |
326 private: | 328 private: |
327 DISALLOW_COPY_AND_ASSIGN(ButtonStripView); | 329 DISALLOW_COPY_AND_ASSIGN(LayoutPropagationView); |
328 }; | 330 }; |
329 | 331 |
330 } // namespace | 332 } // namespace |
331 | 333 |
332 // AutofillDialogViews::SizeLimitedScrollView ---------------------------------- | 334 // AutofillDialogViews::SizeLimitedScrollView ---------------------------------- |
333 | 335 |
334 AutofillDialogViews::SizeLimitedScrollView::SizeLimitedScrollView( | 336 AutofillDialogViews::SizeLimitedScrollView::SizeLimitedScrollView( |
335 views::View* scroll_contents) | 337 views::View* scroll_contents) |
336 : max_height_(-1) { | 338 : max_height_(-1) { |
337 set_hide_horizontal_scrollbar(true); | 339 set_hide_horizontal_scrollbar(true); |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 | 1212 |
1211 views::View* AutofillDialogViews::CreateExtraView() { | 1213 views::View* AutofillDialogViews::CreateExtraView() { |
1212 return button_strip_extra_view_; | 1214 return button_strip_extra_view_; |
1213 } | 1215 } |
1214 | 1216 |
1215 views::View* AutofillDialogViews::CreateTitlebarExtraView() { | 1217 views::View* AutofillDialogViews::CreateTitlebarExtraView() { |
1216 return account_chooser_; | 1218 return account_chooser_; |
1217 } | 1219 } |
1218 | 1220 |
1219 views::View* AutofillDialogViews::CreateFootnoteView() { | 1221 views::View* AutofillDialogViews::CreateFootnoteView() { |
1220 footnote_view_ = new views::View(); | 1222 footnote_view_ = new LayoutPropagationView(); |
1221 footnote_view_->SetLayoutManager( | 1223 footnote_view_->SetLayoutManager( |
1222 new views::BoxLayout(views::BoxLayout::kVertical, | 1224 new views::BoxLayout(views::BoxLayout::kVertical, |
1223 kLegalDocPadding, | 1225 kLegalDocPadding, |
1224 kLegalDocPadding, | 1226 kLegalDocPadding, |
1225 0)); | 1227 0)); |
1226 footnote_view_->set_border( | 1228 footnote_view_->set_border( |
1227 views::Border::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); | 1229 views::Border::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); |
1228 footnote_view_->set_background( | 1230 footnote_view_->set_background( |
1229 views::Background::CreateSolidBackground(kShadingColor)); | 1231 views::Background::CreateSolidBackground(kShadingColor)); |
1230 | 1232 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 DetailsGroup* group = GroupForView(combobox); | 1364 DetailsGroup* group = GroupForView(combobox); |
1363 ValidateGroup(*group, VALIDATE_EDIT); | 1365 ValidateGroup(*group, VALIDATE_EDIT); |
1364 } | 1366 } |
1365 | 1367 |
1366 void AutofillDialogViews::StyledLabelLinkClicked(const ui::Range& range, | 1368 void AutofillDialogViews::StyledLabelLinkClicked(const ui::Range& range, |
1367 int event_flags) { | 1369 int event_flags) { |
1368 controller_->LegalDocumentLinkClicked(range); | 1370 controller_->LegalDocumentLinkClicked(range); |
1369 } | 1371 } |
1370 | 1372 |
1371 void AutofillDialogViews::InitChildViews() { | 1373 void AutofillDialogViews::InitChildViews() { |
1372 button_strip_extra_view_ = new ButtonStripView(); | 1374 button_strip_extra_view_ = new LayoutPropagationView(); |
1373 button_strip_extra_view_->SetLayoutManager( | 1375 button_strip_extra_view_->SetLayoutManager( |
1374 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 1376 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
1375 | 1377 |
1376 save_in_chrome_checkbox_ = | 1378 save_in_chrome_checkbox_ = |
1377 new views::Checkbox(controller_->SaveLocallyText()); | 1379 new views::Checkbox(controller_->SaveLocallyText()); |
1378 save_in_chrome_checkbox_->SetChecked(true); | 1380 save_in_chrome_checkbox_->SetChecked(true); |
1379 button_strip_extra_view_->AddChildView(save_in_chrome_checkbox_); | 1381 button_strip_extra_view_->AddChildView(save_in_chrome_checkbox_); |
1380 | 1382 |
1381 autocheckout_progress_bar_view_ = new views::View(); | 1383 autocheckout_progress_bar_view_ = new views::View(); |
1382 autocheckout_progress_bar_view_->SetLayoutManager( | 1384 autocheckout_progress_bar_view_->SetLayoutManager( |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 1940 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
1939 : section(section), | 1941 : section(section), |
1940 container(NULL), | 1942 container(NULL), |
1941 manual_input(NULL), | 1943 manual_input(NULL), |
1942 suggested_info(NULL), | 1944 suggested_info(NULL), |
1943 suggested_button(NULL) {} | 1945 suggested_button(NULL) {} |
1944 | 1946 |
1945 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 1947 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
1946 | 1948 |
1947 } // namespace autofill | 1949 } // namespace autofill |
OLD | NEW |