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_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_UI_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_UI_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "components/autofill/core/browser/legal_message_line.h" | 13 #include "components/autofill/core/browser/legal_message_line.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 | 17 |
18 class CreditCard; | 18 class CreditCard; |
19 class SaveCardBubbleView; | 19 class SaveCardBubbleView; |
20 | 20 |
21 // Interface that exposes controller functionality to SaveCardBubbleView. | 21 // Interface that exposes controller functionality to SaveCardBubbleView. |
22 class SaveCardBubbleController { | 22 class SaveCardBubbleController { |
23 public: | 23 public: |
24 // Returns the title that should be displayed in the bubble. | 24 // Returns the title that should be displayed in the bubble. |
25 virtual base::string16 GetWindowTitle() const = 0; | 25 virtual base::string16 GetWindowTitle() const = 0; |
26 | 26 |
27 // Returns the explanatory text that should be displayed in the bubble. | 27 // Returns the explanatory text that should be displayed in the bubble. |
28 // Returns an empty string if no message should be displayed. | 28 // Returns an empty string if no message should be displayed. |
29 virtual base::string16 GetExplanatoryMessage() const = 0; | 29 virtual base::string16 GetExplanatoryMessage() const = 0; |
30 | 30 |
31 // Returns the card that will be uploaded if the user accepts. | 31 // Returns the card that will be uploaded if the user accepts. |
32 virtual const CreditCard GetCard() const = 0; | 32 virtual const CreditCard GetCard() const = 0; |
33 | 33 |
34 // Returns the CVC image icon. | |
35 virtual int GetCvcImageRid() const = 0; | |
36 | |
37 // Returns whether the dialog should include a field requesting the card's CVC | |
38 // from the user. | |
39 virtual bool ShouldRequestCvcFromUser() const = 0; | |
40 | |
41 // Takes in the CVC provided by the user in the save card bubble (if it was | |
42 // not detected on the page), to be populated in the final request. | |
csashi
2017/04/02 22:36:15
You can remove the "(if it was not detected on the
Jared Saul
2017/04/03 18:52:59
Done.
| |
43 virtual void SetCvcEnteredByUser(const base::string16& cvc) = 0; | |
44 | |
45 // Returns the CVC provided by the user in the save card bubble (if it was not | |
46 // detected on the page). | |
csashi
2017/04/02 22:36:15
Same as above.
Jared Saul
2017/04/03 18:52:59
Done.
| |
47 virtual base::string16 GetCvcEnteredByUser() const = 0; | |
48 | |
34 // Interaction. | 49 // Interaction. |
35 virtual void OnSaveButton() = 0; | 50 virtual void OnSaveButton() = 0; |
36 virtual void OnCancelButton() = 0; | 51 virtual void OnCancelButton() = 0; |
37 virtual void OnLearnMoreClicked() = 0; | 52 virtual void OnLearnMoreClicked() = 0; |
38 virtual void OnLegalMessageLinkClicked(const GURL& url) = 0; | 53 virtual void OnLegalMessageLinkClicked(const GURL& url) = 0; |
39 virtual void OnBubbleClosed() = 0; | 54 virtual void OnBubbleClosed() = 0; |
40 | 55 |
41 // State. | 56 // State. |
42 | 57 |
43 // Returns empty vector if no legal message should be shown. | 58 // Returns empty vector if no legal message should be shown. |
44 virtual const LegalMessageLines& GetLegalMessageLines() const = 0; | 59 virtual const LegalMessageLines& GetLegalMessageLines() const = 0; |
45 | 60 |
61 // Utilities. | |
62 virtual bool InputCvcIsValid(const base::string16& input_text) const = 0; | |
63 | |
46 protected: | 64 protected: |
47 SaveCardBubbleController() {} | 65 SaveCardBubbleController() {} |
48 virtual ~SaveCardBubbleController() {} | 66 virtual ~SaveCardBubbleController() {} |
49 | 67 |
50 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); | 68 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); |
51 }; | 69 }; |
52 | 70 |
53 } // namespace autofill | 71 } // namespace autofill |
54 | 72 |
55 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ | 73 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_UI_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
OLD | NEW |