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 CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ui/gfx/range/range.h" |
| 13 #include "url/gurl.h" |
10 | 14 |
11 namespace autofill { | 15 namespace autofill { |
12 | 16 |
13 class SaveCardBubbleView; | 17 class SaveCardBubbleView; |
14 | 18 |
15 // Interface that exposes controller functionality to SaveCardBubbleView. | 19 // Interface that exposes controller functionality to SaveCardBubbleView. |
16 class SaveCardBubbleController { | 20 class SaveCardBubbleController { |
17 public: | 21 public: |
| 22 struct LegalMessageLine { |
| 23 struct Link { |
| 24 gfx::Range range; |
| 25 GURL url; |
| 26 }; |
| 27 |
| 28 LegalMessageLine(); |
| 29 ~LegalMessageLine(); |
| 30 |
| 31 base::string16 text; |
| 32 std::vector<Link> links; |
| 33 }; |
| 34 |
| 35 typedef std::vector<LegalMessageLine> LegalMessageLines; |
| 36 |
18 // Returns the title that should be displayed in the bubble. | 37 // Returns the title that should be displayed in the bubble. |
19 virtual base::string16 GetWindowTitle() const = 0; | 38 virtual base::string16 GetWindowTitle() const = 0; |
20 | 39 |
21 // Returns the explanatory text that should be displayed in the bubble. | 40 // Returns the explanatory text that should be displayed in the bubble. |
22 // Returns an empty string if no message should be displayed. | 41 // Returns an empty string if no message should be displayed. |
23 virtual base::string16 GetExplanatoryMessage() const = 0; | 42 virtual base::string16 GetExplanatoryMessage() const = 0; |
24 | 43 |
| 44 // Interaction. |
25 virtual void OnSaveButton() = 0; | 45 virtual void OnSaveButton() = 0; |
26 virtual void OnCancelButton() = 0; | 46 virtual void OnCancelButton() = 0; |
27 virtual void OnLearnMoreClicked() = 0; | 47 virtual void OnLearnMoreClicked() = 0; |
| 48 virtual void OnLegalMessageLinkClicked(const GURL& url) = 0; |
28 virtual void OnBubbleClosed() = 0; | 49 virtual void OnBubbleClosed() = 0; |
29 | 50 |
| 51 // State. |
| 52 |
| 53 // Returns empty vector if no legal message should be shown. |
| 54 virtual const LegalMessageLines& GetLegalMessageLines() const = 0; |
| 55 |
30 protected: | 56 protected: |
31 SaveCardBubbleController() {} | 57 SaveCardBubbleController() {} |
32 virtual ~SaveCardBubbleController() {} | 58 virtual ~SaveCardBubbleController() {} |
33 | 59 |
34 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); | 60 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleController); |
35 }; | 61 }; |
36 | 62 |
37 } // namespace autofill | 63 } // namespace autofill |
38 | 64 |
39 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ | 65 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_H_ |
OLD | NEW |