| 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_view.h" | 9 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" |
| 10 #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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 public views::StyledLabelListener, | 35 public views::StyledLabelListener, |
| 36 public views::TextfieldController { | 36 public views::TextfieldController { |
| 37 public: | 37 public: |
| 38 // Bubble will be anchored to |anchor_view|. | 38 // Bubble will be anchored to |anchor_view|. |
| 39 SaveCardBubbleViews(views::View* anchor_view, | 39 SaveCardBubbleViews(views::View* anchor_view, |
| 40 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
| 41 SaveCardBubbleController* controller); | 41 SaveCardBubbleController* controller); |
| 42 | 42 |
| 43 void Show(DisplayReason reason); | 43 void Show(DisplayReason reason); |
| 44 | 44 |
| 45 // SaveCardBubbleView | 45 // SaveCardBubbleView: |
| 46 void Hide() override; | 46 void Hide() override; |
| 47 | 47 |
| 48 // views::BubbleDialogDelegateView | 48 // views::BubbleDialogDelegateView: |
| 49 views::View* CreateExtraView() override; | 49 views::View* CreateExtraView() override; |
| 50 views::View* CreateFootnoteView() override; | 50 views::View* CreateFootnoteView() override; |
| 51 bool Accept() override; | 51 bool Accept() override; |
| 52 bool Cancel() override; | 52 bool Cancel() override; |
| 53 bool Close() override; | 53 bool Close() override; |
| 54 int GetDialogButtons() const override; |
| 54 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 55 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 55 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 56 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 56 | 57 |
| 57 // views::View | 58 // views::View: |
| 58 gfx::Size CalculatePreferredSize() const override; | 59 gfx::Size CalculatePreferredSize() const override; |
| 59 | 60 |
| 60 // views::WidgetDelegate | 61 // views::WidgetDelegate: |
| 62 bool ShouldShowCloseButton() const override; |
| 61 base::string16 GetWindowTitle() const override; | 63 base::string16 GetWindowTitle() const override; |
| 62 void WindowClosing() override; | 64 void WindowClosing() override; |
| 63 | 65 |
| 64 // views::LinkListener | 66 // views::LinkListener: |
| 65 void LinkClicked(views::Link* source, int event_flags) override; | 67 void LinkClicked(views::Link* source, int event_flags) override; |
| 66 | 68 |
| 67 // views::StyledLabelListener | 69 // views::StyledLabelListener: |
| 68 void StyledLabelLinkClicked(views::StyledLabel* label, | 70 void StyledLabelLinkClicked(views::StyledLabel* label, |
| 69 const gfx::Range& range, | 71 const gfx::Range& range, |
| 70 int event_flags) override; | 72 int event_flags) override; |
| 71 | 73 |
| 72 // views::TextfieldController | 74 // views::TextfieldController: |
| 73 void ContentsChanged(views::Textfield* sender, | 75 void ContentsChanged(views::Textfield* sender, |
| 74 const base::string16& new_contents) override; | 76 const base::string16& new_contents) override; |
| 75 | 77 |
| 76 private: | 78 private: |
| 79 // The current step of the save card flow. Accounts for: |
| 80 // 1) Local save vs. Upload save |
| 81 // 2) Upload save can have all information or be missing CVC |
| 82 enum CurrentFlowStep { |
| 83 UNKNOWN_STEP, |
| 84 LOCAL_SAVE_ONLY_STEP, |
| 85 UPLOAD_SAVE_ONLY_STEP, |
| 86 UPLOAD_SAVE_CVC_FIX_FLOW_STEP_1_OFFER_UPLOAD, |
| 87 UPLOAD_SAVE_CVC_FIX_FLOW_STEP_2_REQUEST_CVC, |
| 88 }; |
| 89 |
| 77 ~SaveCardBubbleViews() override; | 90 ~SaveCardBubbleViews() override; |
| 78 | 91 |
| 92 CurrentFlowStep GetCurrentFlowStep() const; |
| 79 std::unique_ptr<views::View> CreateMainContentView(); | 93 std::unique_ptr<views::View> CreateMainContentView(); |
| 80 std::unique_ptr<views::View> CreateRequestCvcView(); | 94 std::unique_ptr<views::View> CreateRequestCvcView(); |
| 81 | 95 |
| 82 // views::BubbleDialogDelegateView | 96 // views::BubbleDialogDelegateView: |
| 83 void Init() override; | 97 void Init() override; |
| 84 | 98 |
| 85 SaveCardBubbleController* controller_; // Weak reference. | 99 SaveCardBubbleController* controller_; // Weak reference. |
| 86 | 100 |
| 101 views::View* footnote_view_ = nullptr; |
| 102 |
| 87 ViewStack* view_stack_ = nullptr; | 103 ViewStack* view_stack_ = nullptr; |
| 88 | 104 |
| 89 views::Textfield* cvc_textfield_ = nullptr; | 105 views::Textfield* cvc_textfield_ = nullptr; |
| 90 | 106 |
| 91 views::Link* learn_more_link_ = nullptr; | 107 views::Link* learn_more_link_ = nullptr; |
| 92 | 108 |
| 93 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); | 109 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); |
| 94 }; | 110 }; |
| 95 | 111 |
| 96 } // namespace autofill | 112 } // namespace autofill |
| 97 | 113 |
| 98 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 114 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
| OLD | NEW |