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

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: fix unit tests Created 7 years, 3 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
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bd0db6d8cf3db150d24f3aa5ac2b6c825fda5e56..e41ad232668e538402cc1f1bd596b080833b4dcd 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -522,10 +522,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) {
set_background(views::Background::CreateSolidBackground(GetNativeTheme()->
GetSystemColor(ui::NativeTheme::kColorId_DialogBackground)));
@@ -537,9 +539,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() {}
@@ -552,14 +551,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;
@@ -584,13 +584,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() {
@@ -634,17 +640,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();
@@ -1206,7 +1203,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();
}
}
@@ -1267,7 +1264,8 @@ void AutofillDialogViews::UpdateButtonStrip() {
UpdateButtonStripExtraView();
GetDialogClientView()->UpdateDialogButtons();
- overlay_view_->SetState(delegate_->GetDialogOverlay(), this);
+ DialogOverlayState overlay_state = delegate_->GetDialogOverlay();
+ overlay_view_->UpdateState();
ContentsPreferredSizeChanged();
}
@@ -1591,12 +1589,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);
@@ -1789,7 +1781,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);
}
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698