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. | |
Mathieu
2017/04/03 19:46:09
... resource ID.
Jared Saul
2017/04/03 21:19:18
Done.
| |
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, to be | |
42 // populated in the final request. | |
43 virtual void SetCvcEnteredByUser(const base::string16& cvc) = 0; | |
44 | |
45 // Returns the CVC provided by the user in the save card bubble. | |
46 virtual base::string16 GetCvcEnteredByUser() const = 0; | |
47 | |
34 // Interaction. | 48 // Interaction. |
35 virtual void OnSaveButton() = 0; | 49 virtual void OnSaveButton() = 0; |
36 virtual void OnCancelButton() = 0; | 50 virtual void OnCancelButton() = 0; |
37 virtual void OnLearnMoreClicked() = 0; | 51 virtual void OnLearnMoreClicked() = 0; |
38 virtual void OnLegalMessageLinkClicked(const GURL& url) = 0; | 52 virtual void OnLegalMessageLinkClicked(const GURL& url) = 0; |
39 virtual void OnBubbleClosed() = 0; | 53 virtual void OnBubbleClosed() = 0; |
40 | 54 |
41 // State. | 55 // State. |
42 | 56 |
43 // Returns empty vector if no legal message should be shown. | 57 // Returns empty vector if no legal message should be shown. |
44 virtual const LegalMessageLines& GetLegalMessageLines() const = 0; | 58 virtual const LegalMessageLines& GetLegalMessageLines() const = 0; |
45 | 59 |
60 // Utilities. | |
61 virtual bool InputCvcIsValid(const base::string16& input_text) const = 0; | |
62 | |
46 protected: | 63 protected: |
47 SaveCardBubbleController() {} | 64 SaveCardBubbleController() {} |
48 virtual ~SaveCardBubbleController() {} | 65 virtual ~SaveCardBubbleController() {} |
49 | 66 |
50 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); | 67 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); |
51 }; | 68 }; |
52 | 69 |
53 } // namespace autofill | 70 } // namespace autofill |
54 | 71 |
55 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ | 72 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_UI_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
OLD | NEW |