| 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_SAVE_CARD_BUBBLE_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/autofill/save_card_bubble_controller.h" | |
| 10 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" | 9 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" |
| 11 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
| 11 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h" |
| 12 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
| 13 #include "ui/views/controls/styled_label_listener.h" | 13 #include "ui/views/controls/styled_label_listener.h" |
| 14 #include "ui/views/controls/textfield/textfield_controller.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 class WebContents; | 17 class WebContents; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace views { | 20 namespace views { |
| 20 class Link; | 21 class Link; |
| 21 class StyledLabel; | 22 class StyledLabel; |
| 23 class Textfield; |
| 22 } | 24 } |
| 23 | 25 |
| 24 namespace autofill { | 26 namespace autofill { |
| 25 | 27 |
| 26 // This class displays the "Save credit card?" bubble that is shown when the | 28 // This class displays the "Save credit card?" bubble that is shown when the |
| 27 // user submits a form with a credit card number that Autofill has not | 29 // user submits a form with a credit card number that Autofill has not |
| 28 // previously saved. | 30 // previously saved. |
| 29 class SaveCardBubbleViews : public SaveCardBubbleView, | 31 class SaveCardBubbleViews : public SaveCardBubbleView, |
| 30 public LocationBarBubbleDelegateView, | 32 public LocationBarBubbleDelegateView, |
| 31 public views::LinkListener, | 33 public views::LinkListener, |
| 32 public views::StyledLabelListener { | 34 public views::StyledLabelListener, |
| 35 public views::TextfieldController { |
| 33 public: | 36 public: |
| 34 // Bubble will be anchored to |anchor_view|. | 37 // Bubble will be anchored to |anchor_view|. |
| 35 SaveCardBubbleViews(views::View* anchor_view, | 38 SaveCardBubbleViews(views::View* anchor_view, |
| 36 content::WebContents* web_contents, | 39 content::WebContents* web_contents, |
| 37 SaveCardBubbleController* controller); | 40 SaveCardBubbleController* controller); |
| 38 | 41 |
| 39 void Show(DisplayReason reason); | 42 void Show(DisplayReason reason); |
| 40 | 43 |
| 41 // SaveCardBubbleView | 44 // SaveCardBubbleView |
| 42 void Hide() override; | 45 void Hide() override; |
| 43 | 46 |
| 44 // views::BubbleDialogDelegateView | 47 // views::BubbleDialogDelegateView |
| 45 views::View* CreateExtraView() override; | 48 views::View* CreateExtraView() override; |
| 46 views::View* CreateFootnoteView() override; | 49 views::View* CreateFootnoteView() override; |
| 47 bool Accept() override; | 50 bool Accept() override; |
| 48 bool Cancel() override; | 51 bool Cancel() override; |
| 49 bool Close() override; | 52 bool Close() override; |
| 50 int GetDialogButtons() const override; | 53 int GetDialogButtons() const override; |
| 51 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 54 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 55 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 52 bool ShouldDefaultButtonBeBlue() const override; | 56 bool ShouldDefaultButtonBeBlue() const override; |
| 53 | 57 |
| 54 // views::View | 58 // views::View |
| 55 gfx::Size GetPreferredSize() const override; | 59 gfx::Size GetPreferredSize() const override; |
| 56 | 60 |
| 57 // views::WidgetDelegate | 61 // views::WidgetDelegate |
| 58 base::string16 GetWindowTitle() const override; | 62 base::string16 GetWindowTitle() const override; |
| 59 void WindowClosing() override; | 63 void WindowClosing() override; |
| 60 | 64 |
| 61 // views::LinkListener | 65 // views::LinkListener |
| 62 void LinkClicked(views::Link* source, int event_flags) override; | 66 void LinkClicked(views::Link* source, int event_flags) override; |
| 63 | 67 |
| 64 // views::StyledLabelListener | 68 // views::StyledLabelListener |
| 65 void StyledLabelLinkClicked(views::StyledLabel* label, | 69 void StyledLabelLinkClicked(views::StyledLabel* label, |
| 66 const gfx::Range& range, | 70 const gfx::Range& range, |
| 67 int event_flags) override; | 71 int event_flags) override; |
| 68 | 72 |
| 73 // views::TextfieldController |
| 74 void ContentsChanged(views::Textfield* sender, |
| 75 const base::string16& new_contents) override; |
| 76 |
| 69 private: | 77 private: |
| 70 ~SaveCardBubbleViews() override; | 78 ~SaveCardBubbleViews() override; |
| 71 | 79 |
| 72 std::unique_ptr<views::View> CreateMainContentView(); | 80 std::unique_ptr<views::View> CreateMainContentView(); |
| 73 | 81 |
| 74 // views::BubbleDialogDelegateView | 82 // views::BubbleDialogDelegateView |
| 75 void Init() override; | 83 void Init() override; |
| 76 | 84 |
| 77 SaveCardBubbleController* controller_; // Weak reference. | 85 SaveCardBubbleController* controller_; // Weak reference. |
| 78 | 86 |
| 87 views::Textfield* cvc_input_; |
| 88 |
| 79 views::Link* learn_more_link_; | 89 views::Link* learn_more_link_; |
| 80 | 90 |
| 81 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); | 91 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); |
| 82 }; | 92 }; |
| 83 | 93 |
| 84 } // namespace autofill | 94 } // namespace autofill |
| 85 | 95 |
| 86 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 96 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
| OLD | NEW |