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