| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 8 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
| 9 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" | 9 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" |
| 10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| 11 #include "ui/gfx/animation/slide_animation.h" | 11 #include "ui/gfx/animation/slide_animation.h" |
| 12 #include "ui/views/controls/combobox/combobox_listener.h" | 12 #include "ui/views/controls/combobox/combobox_listener.h" |
| 13 #include "ui/views/controls/link_listener.h" |
| 13 #include "ui/views/controls/textfield/textfield_controller.h" | 14 #include "ui/views/controls/textfield/textfield_controller.h" |
| 14 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class Checkbox; | 18 class Checkbox; |
| 18 class ImageView; | 19 class ImageView; |
| 19 class Label; | 20 class Label; |
| 21 class Link; |
| 20 class Throbber; | 22 class Throbber; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace autofill { | 25 namespace autofill { |
| 24 | 26 |
| 25 class DecoratedTextfield; | 27 class DecoratedTextfield; |
| 26 | 28 |
| 27 class CardUnmaskPromptViews : public CardUnmaskPromptView, | 29 class CardUnmaskPromptViews : public CardUnmaskPromptView, |
| 28 views::ComboboxListener, | 30 views::ComboboxListener, |
| 29 views::DialogDelegateView, | 31 views::DialogDelegateView, |
| 30 views::TextfieldController, | 32 views::TextfieldController, |
| 33 views::LinkListener, |
| 31 gfx::AnimationDelegate { | 34 gfx::AnimationDelegate { |
| 32 public: | 35 public: |
| 33 explicit CardUnmaskPromptViews(CardUnmaskPromptController* controller); | 36 explicit CardUnmaskPromptViews(CardUnmaskPromptController* controller); |
| 34 | 37 |
| 35 ~CardUnmaskPromptViews() override; | 38 ~CardUnmaskPromptViews() override; |
| 36 | 39 |
| 37 void Show(); | 40 void Show(); |
| 38 | 41 |
| 39 // CardUnmaskPromptView | 42 // CardUnmaskPromptView |
| 40 void ControllerGone() override; | 43 void ControllerGone() override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 61 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 59 bool ShouldDefaultButtonBeBlue() const override; | 62 bool ShouldDefaultButtonBeBlue() const override; |
| 60 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 63 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 61 views::View* GetInitiallyFocusedView() override; | 64 views::View* GetInitiallyFocusedView() override; |
| 62 bool Cancel() override; | 65 bool Cancel() override; |
| 63 bool Accept() override; | 66 bool Accept() override; |
| 64 | 67 |
| 65 // views::TextfieldController | 68 // views::TextfieldController |
| 66 void ContentsChanged(views::Textfield* sender, | 69 void ContentsChanged(views::Textfield* sender, |
| 67 const base::string16& new_contents) override; | 70 const base::string16& new_contents) override; |
| 71 |
| 68 // views::ComboboxListener | 72 // views::ComboboxListener |
| 69 void OnPerformAction(views::Combobox* combobox) override; | 73 void OnPerformAction(views::Combobox* combobox) override; |
| 70 | 74 |
| 75 // views::LinkListener |
| 76 void LinkClicked(views::Link* source, int event_flags) override; |
| 77 |
| 71 // gfx::AnimationDelegate | 78 // gfx::AnimationDelegate |
| 72 void AnimationProgressed(const gfx::Animation* animation) override; | 79 void AnimationProgressed(const gfx::Animation* animation) override; |
| 73 | 80 |
| 74 private: | 81 private: |
| 75 friend class CardUnmaskPromptViewTesterViews; | 82 friend class CardUnmaskPromptViewTesterViews; |
| 76 | 83 |
| 77 // A view that allows changing the opacity of its contents. | 84 // A view that allows changing the opacity of its contents. |
| 78 class FadeOutView : public views::View { | 85 class FadeOutView : public views::View { |
| 79 public: | 86 public: |
| 80 FadeOutView(); | 87 FadeOutView(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 99 // The alpha channel for this view. 0 is transparent and 255 is opaque. | 106 // The alpha channel for this view. 0 is transparent and 255 is opaque. |
| 100 uint8_t alpha_; | 107 uint8_t alpha_; |
| 101 | 108 |
| 102 DISALLOW_COPY_AND_ASSIGN(FadeOutView); | 109 DISALLOW_COPY_AND_ASSIGN(FadeOutView); |
| 103 }; | 110 }; |
| 104 | 111 |
| 105 void InitIfNecessary(); | 112 void InitIfNecessary(); |
| 106 void SetRetriableErrorMessage(const base::string16& message); | 113 void SetRetriableErrorMessage(const base::string16& message); |
| 107 bool ExpirationDateIsValid() const; | 114 bool ExpirationDateIsValid() const; |
| 108 void SetInputsEnabled(bool enabled); | 115 void SetInputsEnabled(bool enabled); |
| 116 void ShowNewCardLink(); |
| 109 void ClosePrompt(); | 117 void ClosePrompt(); |
| 110 | 118 |
| 111 CardUnmaskPromptController* controller_; | 119 CardUnmaskPromptController* controller_; |
| 112 | 120 |
| 113 views::View* main_contents_; | 121 views::View* main_contents_; |
| 114 | 122 |
| 115 // The error label for permanent errors (where the user can't retry). | 123 // The error label for permanent errors (where the user can't retry). |
| 116 views::Label* permanent_error_label_; | 124 views::Label* permanent_error_label_; |
| 117 | 125 |
| 118 // Holds the cvc and expiration inputs. | 126 // Holds the cvc and expiration inputs. |
| 119 views::View* input_row_; | 127 views::View* input_row_; |
| 120 | 128 |
| 121 DecoratedTextfield* cvc_input_; | 129 DecoratedTextfield* cvc_input_; |
| 122 | 130 |
| 123 // These will be null when expiration date is not required. | |
| 124 views::Combobox* month_input_; | 131 views::Combobox* month_input_; |
| 125 views::Combobox* year_input_; | 132 views::Combobox* year_input_; |
| 126 | 133 |
| 127 MonthComboboxModel month_combobox_model_; | 134 MonthComboboxModel month_combobox_model_; |
| 128 YearComboboxModel year_combobox_model_; | 135 YearComboboxModel year_combobox_model_; |
| 129 | 136 |
| 137 views::Link* new_card_link_; |
| 138 |
| 130 // The error icon and label for most errors, which live beneath the inputs. | 139 // The error icon and label for most errors, which live beneath the inputs. |
| 131 views::ImageView* error_icon_; | 140 views::ImageView* error_icon_; |
| 132 views::Label* error_label_; | 141 views::Label* error_label_; |
| 133 | 142 |
| 134 FadeOutView* storage_row_; | 143 FadeOutView* storage_row_; |
| 135 views::Checkbox* storage_checkbox_; | 144 views::Checkbox* storage_checkbox_; |
| 136 | 145 |
| 137 FadeOutView* progress_overlay_; | 146 FadeOutView* progress_overlay_; |
| 138 views::Throbber* progress_throbber_; | 147 views::Throbber* progress_throbber_; |
| 139 views::Label* progress_label_; | 148 views::Label* progress_label_; |
| 140 | 149 |
| 141 gfx::SlideAnimation overlay_animation_; | 150 gfx::SlideAnimation overlay_animation_; |
| 142 | 151 |
| 143 base::WeakPtrFactory<CardUnmaskPromptViews> weak_ptr_factory_; | 152 base::WeakPtrFactory<CardUnmaskPromptViews> weak_ptr_factory_; |
| 144 | 153 |
| 145 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViews); | 154 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViews); |
| 146 }; | 155 }; |
| 147 | 156 |
| 148 } // namespace autofill | 157 } // namespace autofill |
| 149 | 158 |
| 150 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ | 159 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_CARD_UNMASK_PROMPT_VIEWS_H_ |
| OLD | NEW |