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 SaveCardBubbleController() {} |
| 25 virtual ~SaveCardBubbleController() {} |
| 26 |
24 // Returns the title that should be displayed in the bubble. | 27 // Returns the title that should be displayed in the bubble. |
25 virtual base::string16 GetWindowTitle() const = 0; | 28 virtual base::string16 GetWindowTitle() const = 0; |
26 | 29 |
27 // Returns the explanatory text that should be displayed in the bubble. | 30 // Returns the explanatory text that should be displayed in the bubble. |
28 // Returns an empty string if no message should be displayed. | 31 // Returns an empty string if no message should be displayed. |
29 virtual base::string16 GetExplanatoryMessage() const = 0; | 32 virtual base::string16 GetExplanatoryMessage() const = 0; |
30 | 33 |
31 // Returns the card that will be uploaded if the user accepts. | 34 // Returns the card that will be uploaded if the user accepts. |
32 virtual const CreditCard GetCard() const = 0; | 35 virtual const CreditCard GetCard() const = 0; |
33 | 36 |
| 37 // Returns the CVC image icon resource ID. |
| 38 virtual int GetCvcImageResourceId() const = 0; |
| 39 |
| 40 // Returns whether the dialog should include a field requesting the card's CVC |
| 41 // from the user. |
| 42 virtual bool ShouldRequestCvcFromUser() const = 0; |
| 43 |
| 44 // Returns the CVC provided by the user in the save card bubble. |
| 45 virtual base::string16 GetCvcEnteredByUser() const = 0; |
| 46 |
34 // Interaction. | 47 // Interaction. |
35 virtual void OnSaveButton() = 0; | 48 // OnSaveButton takes in a string value representing the CVC entered by the |
| 49 // user if it was requested, or an empty string otherwise. |
| 50 virtual void OnSaveButton(const base::string16& cvc) = 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 |
46 protected: | 61 // Utilities. |
47 SaveCardBubbleController() {} | 62 virtual bool InputCvcIsValid(const base::string16& input_text) const = 0; |
48 virtual ~SaveCardBubbleController() {} | |
49 | 63 |
| 64 private: |
50 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); | 65 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); |
51 }; | 66 }; |
52 | 67 |
53 } // namespace autofill | 68 } // namespace autofill |
54 | 69 |
55 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ | 70 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_UI_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
OLD | NEW |