Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 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::DialogDelegate | |
| 49 int GetDialogButtons() const override; | |
| 50 | |
| 48 // views::BubbleDialogDelegateView | 51 // views::BubbleDialogDelegateView |
| 49 views::View* CreateExtraView() override; | 52 views::View* CreateExtraView() override; |
| 50 views::View* CreateFootnoteView() override; | 53 views::View* CreateFootnoteView() override; |
| 51 bool Accept() override; | 54 bool Accept() override; |
| 52 bool Cancel() override; | 55 bool Cancel() override; |
| 53 bool Close() override; | 56 bool Close() override; |
| 54 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 57 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 55 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 58 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 56 | 59 |
| 57 // views::View | 60 // views::View |
| 58 gfx::Size CalculatePreferredSize() const override; | 61 gfx::Size CalculatePreferredSize() const override; |
| 59 | 62 |
| 60 // views::WidgetDelegate | 63 // views::WidgetDelegate |
| 64 bool ShouldShowCloseButton() const override; | |
|
jiahuiguo
2017/06/27 01:21:10
Should we add a "Should" here? Looks ShowCloseButt
Jared Saul
2017/06/27 01:31:47
It's overriding a method in views::WidgetDelegate:
| |
| 61 base::string16 GetWindowTitle() const override; | 65 base::string16 GetWindowTitle() const override; |
| 62 void WindowClosing() override; | 66 void WindowClosing() override; |
| 63 | 67 |
| 64 // views::LinkListener | 68 // views::LinkListener |
| 65 void LinkClicked(views::Link* source, int event_flags) override; | 69 void LinkClicked(views::Link* source, int event_flags) override; |
| 66 | 70 |
| 67 // views::StyledLabelListener | 71 // views::StyledLabelListener |
| 68 void StyledLabelLinkClicked(views::StyledLabel* label, | 72 void StyledLabelLinkClicked(views::StyledLabel* label, |
| 69 const gfx::Range& range, | 73 const gfx::Range& range, |
| 70 int event_flags) override; | 74 int event_flags) override; |
| 71 | 75 |
| 72 // views::TextfieldController | 76 // views::TextfieldController |
| 73 void ContentsChanged(views::Textfield* sender, | 77 void ContentsChanged(views::Textfield* sender, |
| 74 const base::string16& new_contents) override; | 78 const base::string16& new_contents) override; |
| 75 | 79 |
| 76 private: | 80 private: |
| 81 // The current step of the save card flow. Accounts for: | |
| 82 // 1) Local save vs. Upload save | |
| 83 // 2) Upload save can have all information or be missing CVC | |
| 84 enum CurrentFlowStep { | |
| 85 UNKNOWN_STEP, | |
| 86 LOCAL_SAVE_ONLY_STEP, | |
| 87 UPLOAD_SAVE_ONLY_STEP, | |
| 88 UPLOAD_SAVE_CVC_FIX_FLOW_STEP_1, | |
|
Shanfeng
2017/06/27 04:00:31
It would be better if replace step_1 with a more s
Jared Saul
2017/06/27 16:38:02
I kept the STEP_1 and STEP_2 parts so it's clear w
| |
| 89 UPLOAD_SAVE_CVC_FIX_FLOW_STEP_2, | |
| 90 }; | |
| 91 | |
| 77 ~SaveCardBubbleViews() override; | 92 ~SaveCardBubbleViews() override; |
| 78 | 93 |
| 94 CurrentFlowStep GetCurrentFlowStep() const; | |
| 79 std::unique_ptr<views::View> CreateMainContentView(); | 95 std::unique_ptr<views::View> CreateMainContentView(); |
| 80 std::unique_ptr<views::View> CreateRequestCvcView(); | 96 std::unique_ptr<views::View> CreateRequestCvcView(); |
| 81 | 97 |
| 82 // views::BubbleDialogDelegateView | 98 // views::BubbleDialogDelegateView |
| 83 void Init() override; | 99 void Init() override; |
| 84 | 100 |
| 85 SaveCardBubbleController* controller_; // Weak reference. | 101 SaveCardBubbleController* controller_; // Weak reference. |
| 86 | 102 |
| 103 views::View* footnote_view_ = nullptr; | |
| 104 | |
| 87 ViewStack* view_stack_ = nullptr; | 105 ViewStack* view_stack_ = nullptr; |
| 88 | 106 |
| 89 views::Textfield* cvc_textfield_ = nullptr; | 107 views::Textfield* cvc_textfield_ = nullptr; |
| 90 | 108 |
| 91 views::Link* learn_more_link_ = nullptr; | 109 views::Link* learn_more_link_ = nullptr; |
| 92 | 110 |
| 93 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); | 111 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); |
| 94 }; | 112 }; |
| 95 | 113 |
| 96 } // namespace autofill | 114 } // namespace autofill |
| 97 | 115 |
| 98 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 116 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
| OLD | NEW |