| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ |
| 7 |
| 8 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
| 9 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" |
| 10 #include "ui/views/controls/combobox/combobox_listener.h" |
| 11 #include "ui/views/controls/textfield/textfield_controller.h" |
| 12 #include "ui/views/window/dialog_delegate.h" |
| 13 |
| 14 namespace views { |
| 15 class Label; |
| 16 class Checkbox; |
| 17 } |
| 18 |
| 19 namespace autofill { |
| 20 |
| 21 class DecoratedTextfield; |
| 22 |
| 23 class CardUnmaskPromptViews : public CardUnmaskPromptView, |
| 24 views::ComboboxListener, |
| 25 views::DialogDelegateView, |
| 26 views::TextfieldController { |
| 27 public: |
| 28 explicit CardUnmaskPromptViews(CardUnmaskPromptController* controller); |
| 29 |
| 30 ~CardUnmaskPromptViews() override; |
| 31 |
| 32 void Show(); |
| 33 |
| 34 // CardUnmaskPromptView |
| 35 void ControllerGone() override; |
| 36 void DisableAndWaitForVerification() override; |
| 37 void GotVerificationResult(const base::string16& error_message, |
| 38 bool allow_retry) override; |
| 39 |
| 40 // views::DialogDelegateView |
| 41 View* GetContentsView() override; |
| 42 views::View* CreateFootnoteView() override; |
| 43 |
| 44 // views::View |
| 45 gfx::Size GetPreferredSize() const override; |
| 46 void Layout() override; |
| 47 int GetHeightForWidth(int width) const override; |
| 48 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 49 ui::ModalType GetModalType() const override; |
| 50 base::string16 GetWindowTitle() const override; |
| 51 void DeleteDelegate() override; |
| 52 int GetDialogButtons() const override; |
| 53 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 54 bool ShouldDefaultButtonBeBlue() const override; |
| 55 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 56 views::View* GetInitiallyFocusedView() override; |
| 57 bool Cancel() override; |
| 58 bool Accept() override; |
| 59 |
| 60 // views::TextfieldController |
| 61 void ContentsChanged(views::Textfield* sender, |
| 62 const base::string16& new_contents) override; |
| 63 // views::ComboboxListener |
| 64 void OnPerformAction(views::Combobox* combobox) override; |
| 65 |
| 66 private: |
| 67 friend class CardUnmaskPromptViewTesterViews; |
| 68 |
| 69 void InitIfNecessary(); |
| 70 void SetRetriableErrorMessage(const base::string16& message); |
| 71 bool ExpirationDateIsValid() const; |
| 72 void SetInputsEnabled(bool enabled); |
| 73 void ClosePrompt(); |
| 74 |
| 75 CardUnmaskPromptController* controller_; |
| 76 |
| 77 views::View* main_contents_; |
| 78 |
| 79 // The error label for permanent errors (where the user can't retry). |
| 80 views::Label* permanent_error_label_; |
| 81 |
| 82 DecoratedTextfield* cvc_input_; |
| 83 |
| 84 // These will be null when expiration date is not required. |
| 85 views::Combobox* month_input_; |
| 86 views::Combobox* year_input_; |
| 87 |
| 88 MonthComboboxModel month_combobox_model_; |
| 89 YearComboboxModel year_combobox_model_; |
| 90 |
| 91 // The error label for most errors, which lives beneath the inputs. |
| 92 views::Label* error_label_; |
| 93 |
| 94 views::Checkbox* storage_checkbox_; |
| 95 |
| 96 views::View* progress_overlay_; |
| 97 views::Label* progress_label_; |
| 98 |
| 99 base::WeakPtrFactory<CardUnmaskPromptViews> weak_ptr_factory_; |
| 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViews); |
| 102 }; |
| 103 |
| 104 } // namespace autofill |
| 105 |
| 106 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ |
| OLD | NEW |