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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 23512003: new animation for rAc card generation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove second string on final interstitial Created 7 years, 4 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/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index 7ff0aabda44785b26d73e970570a1f304b02c471..217422ad029dc2fe4e102f15c38b55cf98ec5930 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -572,10 +572,12 @@ void AutofillDialogViews::AccountChooser::LinkClicked(views::Link* source,
// AutofillDialogViews::OverlayView --------------------------------------------
-AutofillDialogViews::OverlayView::OverlayView(views::ButtonListener* listener)
- : image_view_(new views::ImageView()),
+AutofillDialogViews::OverlayView::OverlayView(
+ AutofillDialogViewDelegate* delegate)
+ : delegate_(delegate),
+ image_view_(new views::ImageView()),
message_stack_(new views::View()),
- button_(new views::BlueButton(listener, base::string16())) {
+ refresh_timer_(false, false) {
groby-ooo-7-16 2013/09/03 18:50:04 If we keep the timer in OverlayView - why not a re
Evan Stade 2013/09/03 19:05:37 I don't see how that would reduce the code complex
groby-ooo-7-16 2013/09/03 22:21:41 My above statement missed a don't, I think. A repe
set_background(views::Background::CreateSolidBackground(GetNativeTheme()->
GetSystemColor(ui::NativeTheme::kColorId_DialogBackground)));
@@ -587,9 +589,6 @@ AutofillDialogViews::OverlayView::OverlayView(views::ButtonListener* listener)
kOverlayTextInterlineSpacing));
message_stack_->set_border(views::Border::CreateEmptyBorder(
kDialogEdgePadding, kDialogEdgePadding, 0, kDialogEdgePadding));
-
- AddChildView(button_);
- button_->set_focusable(true);
}
AutofillDialogViews::OverlayView::~OverlayView() {}
@@ -602,14 +601,15 @@ int AutofillDialogViews::OverlayView::GetHeightForContentsForWidth(int width) {
return kOverlayImageBottomMargin +
views::kButtonVEdgeMarginNew +
message_stack_->GetHeightForWidth(width) +
- image_view_->GetHeightForWidth(width) +
- (button_->visible() ? button_->GetHeightForWidth(width) +
- views::kButtonVEdgeMarginNew : 0);
+ image_view_->GetHeightForWidth(width);
+}
+
+void AutofillDialogViews::OverlayView::UpdateState() {
+ SetState(delegate_->GetDialogOverlay());
}
void AutofillDialogViews::OverlayView::SetState(
- const DialogOverlayState& state,
- views::ButtonListener* listener) {
+ const DialogOverlayState& state) {
// Don't update anything if we're still fading out the old state.
if (fade_out_)
return;
@@ -634,13 +634,19 @@ void AutofillDialogViews::OverlayView::SetState(
}
message_stack_->SetVisible(message_stack_->child_count() > 0);
- button_->SetVisible(!state.button_text.empty());
- if (!state.button_text.empty())
- button_->SetText(state.button_text);
-
SetVisible(true);
+ InvalidateLayout();
if (parent())
parent()->Layout();
+
+ if (state.expiry != base::TimeDelta()) {
+ refresh_timer_.Start(FROM_HERE,
+ state.expiry,
+ base::Bind(&OverlayView::UpdateState,
+ base::Unretained(this)));
+ } else {
+ refresh_timer_.Stop();
+ }
}
void AutofillDialogViews::OverlayView::BeginFadeOut() {
@@ -684,17 +690,8 @@ void AutofillDialogViews::OverlayView::Layout() {
return;
}
- int y = bounds.bottom() - views::kButtonVEdgeMarginNew;
- if (button_->visible()) {
- button_->SizeToPreferredSize();
- y -= button_->height();
- button_->SetPosition(gfx::Point(
- bounds.CenterPoint().x() - button_->width() / 2, y));
- y -= views::kButtonVEdgeMarginNew;
- }
-
int message_height = message_stack_->GetHeightForWidth(bounds.width());
- y -= message_height;
+ int y = bounds.bottom() - views::kButtonVEdgeMarginNew - message_height;
message_stack_->SetBounds(bounds.x(), y, bounds.width(), message_height);
gfx::Size image_size = image_view_->GetPreferredSize();
@@ -1296,7 +1293,7 @@ void AutofillDialogViews::Show() {
if (!splash_image.IsEmpty()) {
DialogOverlayState state;
state.image = splash_image;
- overlay_view_->SetState(state, NULL);
+ overlay_view_->SetState(state);
overlay_view_->BeginFadeOut();
}
}
@@ -1362,7 +1359,8 @@ void AutofillDialogViews::UpdateButtonStrip() {
UpdateButtonStripExtraView();
GetDialogClientView()->UpdateDialogButtons();
- overlay_view_->SetState(delegate_->GetDialogOverlay(), this);
+ DialogOverlayState overlay_state = delegate_->GetDialogOverlay();
+ overlay_view_->UpdateState();
ContentsPreferredSizeChanged();
}
@@ -1698,12 +1696,6 @@ views::NonClientFrameView* AutofillDialogViews::CreateNonClientFrameView(
delegate_->GetWebContents()->GetBrowserContext());
}
-void AutofillDialogViews::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- DCHECK(sender->GetAncestorWithClassName(kOverlayViewClassName));
- delegate_->OverlayButtonPressed();
-}
-
void AutofillDialogViews::ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) {
TextfieldEditedOrActivated(sender, true);
@@ -1921,7 +1913,7 @@ void AutofillDialogViews::InitChildViews() {
new AutofillDialogSignInDelegate(this,
sign_in_webview_->GetWebContents()));
- overlay_view_ = new OverlayView(this);
+ overlay_view_ = new OverlayView(delegate_);
overlay_view_->SetVisible(false);
}

Powered by Google App Engine
This is Rietveld 408576698