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

Unified Diff: chrome/browser/ui/views/autofill/card_unmask_prompt_views.h

Issue 1020013003: Add a regression test for the CardUnmaskPrompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: EXPECT Created 5 years, 9 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/card_unmask_prompt_views.h
diff --git a/chrome/browser/ui/views/autofill/card_unmask_prompt_views.h b/chrome/browser/ui/views/autofill/card_unmask_prompt_views.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa1f442083d1d4a04b73f513958d8763eb07a22b
--- /dev/null
+++ b/chrome/browser/ui/views/autofill/card_unmask_prompt_views.h
@@ -0,0 +1,106 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_
+#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_
+
+#include "chrome/browser/ui/autofill/autofill_dialog_models.h"
+#include "chrome/browser/ui/autofill/card_unmask_prompt_view.h"
+#include "ui/views/controls/combobox/combobox_listener.h"
+#include "ui/views/controls/textfield/textfield_controller.h"
+#include "ui/views/window/dialog_delegate.h"
+
+namespace views {
+class Label;
+class Checkbox;
+}
+
+namespace autofill {
+
+class DecoratedTextfield;
+
+class CardUnmaskPromptViews : public CardUnmaskPromptView,
+ views::ComboboxListener,
+ views::DialogDelegateView,
+ views::TextfieldController {
+ public:
+ explicit CardUnmaskPromptViews(CardUnmaskPromptController* controller);
+
+ ~CardUnmaskPromptViews() override;
+
+ void Show();
+
+ // CardUnmaskPromptView
+ void ControllerGone() override;
+ void DisableAndWaitForVerification() override;
+ void GotVerificationResult(const base::string16& error_message,
+ bool allow_retry) override;
+
+ // views::DialogDelegateView
+ View* GetContentsView() override;
+ views::View* CreateFootnoteView() override;
+
+ // views::View
+ gfx::Size GetPreferredSize() const override;
+ void Layout() override;
+ int GetHeightForWidth(int width) const override;
+ void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
+ ui::ModalType GetModalType() const override;
+ base::string16 GetWindowTitle() const override;
+ void DeleteDelegate() override;
+ int GetDialogButtons() const override;
+ base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
+ bool ShouldDefaultButtonBeBlue() const override;
+ bool IsDialogButtonEnabled(ui::DialogButton button) const override;
+ views::View* GetInitiallyFocusedView() override;
+ bool Cancel() override;
+ bool Accept() override;
+
+ // views::TextfieldController
+ void ContentsChanged(views::Textfield* sender,
+ const base::string16& new_contents) override;
+ // views::ComboboxListener
+ void OnPerformAction(views::Combobox* combobox) override;
+
+ private:
+ friend class CardUnmaskPromptViewTesterViews;
+
+ void InitIfNecessary();
+ void SetRetriableErrorMessage(const base::string16& message);
+ bool ExpirationDateIsValid() const;
+ void SetInputsEnabled(bool enabled);
+ void ClosePrompt();
+
+ CardUnmaskPromptController* controller_;
+
+ views::View* main_contents_;
+
+ // The error label for permanent errors (where the user can't retry).
+ views::Label* permanent_error_label_;
+
+ DecoratedTextfield* cvc_input_;
+
+ // These will be null when expiration date is not required.
+ views::Combobox* month_input_;
+ views::Combobox* year_input_;
+
+ MonthComboboxModel month_combobox_model_;
+ YearComboboxModel year_combobox_model_;
+
+ // The error label for most errors, which lives beneath the inputs.
+ views::Label* error_label_;
+
+ views::Checkbox* storage_checkbox_;
+
+ views::View* progress_overlay_;
+ views::Label* progress_label_;
+
+ base::WeakPtrFactory<CardUnmaskPromptViews> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViews);
+};
+
+} // namespace autofill
+
+#endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_

Powered by Google App Engine
This is Rietveld 408576698