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_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/ui/autofill/save_card_bubble_controller.h" | |
9 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" | 10 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" |
10 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h" | 11 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h" |
11 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
12 #include "ui/views/controls/link_listener.h" | 13 #include "ui/views/controls/link_listener.h" |
14 #include "ui/views/controls/styled_label_listener.h" | |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 class WebContents; | 17 class WebContents; |
16 } | 18 } |
17 | 19 |
18 namespace views { | 20 namespace views { |
19 class LabelButton; | 21 class LabelButton; |
20 class Link; | 22 class Link; |
23 class StyledLabel; | |
21 } | 24 } |
22 | 25 |
23 namespace autofill { | 26 namespace autofill { |
24 | 27 |
25 class SaveCardBubbleController; | |
26 | |
27 // This class displays the "Save credit card?" bubble that is shown when the | 28 // This class displays the "Save credit card?" bubble that is shown when the |
28 // user submits a form with a credit card number that Autofill has not | 29 // user submits a form with a credit card number that Autofill has not |
29 // previously saved. | 30 // previously saved. |
30 class SaveCardBubbleViews : public SaveCardBubbleView, | 31 class SaveCardBubbleViews : public SaveCardBubbleView, |
31 public LocationBarBubbleDelegateView, | 32 public LocationBarBubbleDelegateView, |
32 public views::ButtonListener, | 33 public views::ButtonListener, |
33 public views::LinkListener { | 34 public views::LinkListener, |
35 public views::StyledLabelListener { | |
34 public: | 36 public: |
35 // Bubble will be anchored to |anchor_view|. | 37 // Bubble will be anchored to |anchor_view|. |
36 SaveCardBubbleViews(views::View* anchor_view, | 38 SaveCardBubbleViews(views::View* anchor_view, |
37 content::WebContents* web_contents, | 39 content::WebContents* web_contents, |
38 SaveCardBubbleController* controller); | 40 SaveCardBubbleController* controller); |
39 | 41 |
40 void Show(DisplayReason reason); | 42 void Show(DisplayReason reason); |
41 | 43 |
42 // SaveCardBubbleView | 44 // SaveCardBubbleView |
43 void Hide() override; | 45 void Hide() override; |
44 | 46 |
45 // views::WidgetDelegate | 47 // views::WidgetDelegate |
46 views::View* GetInitiallyFocusedView() override; | 48 views::View* GetInitiallyFocusedView() override; |
47 base::string16 GetWindowTitle() const override; | 49 base::string16 GetWindowTitle() const override; |
48 bool ShouldShowWindowTitle() const override; | 50 bool ShouldShowWindowTitle() const override; |
49 void WindowClosing() override; | 51 void WindowClosing() override; |
50 | 52 |
51 // views::ButtonListener | 53 // views::ButtonListener |
52 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 54 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
53 | 55 |
54 // views::LinkListener | 56 // views::LinkListener |
55 void LinkClicked(views::Link* source, int event_flags) override; | 57 void LinkClicked(views::Link* source, int event_flags) override; |
56 | 58 |
59 // views::StyledLabelListener | |
60 void StyledLabelLinkClicked(views::StyledLabel* label, | |
61 const gfx::Range& range, | |
62 int event_flags) override; | |
63 | |
57 private: | 64 private: |
58 ~SaveCardBubbleViews() override; | 65 ~SaveCardBubbleViews() override; |
59 | 66 |
67 scoped_ptr<views::View> CreateMainContentView(); | |
68 scoped_ptr<views::View> CreateFootnoteView(); | |
69 | |
60 // views::BubbleDelegateView | 70 // views::BubbleDelegateView |
61 void Init() override; | 71 void Init() override; |
62 | 72 |
63 SaveCardBubbleController* controller_; // Weak reference. | 73 SaveCardBubbleController* controller_; // Weak reference. |
64 | 74 |
65 // Button for the user to confirm saving the credit card info. | 75 // Button for the user to confirm saving the credit card info. |
66 views::LabelButton* save_button_; | 76 views::LabelButton* save_button_; |
67 | 77 |
68 views::LabelButton* cancel_button_; | 78 views::LabelButton* cancel_button_; |
69 | 79 |
80 // Mapping of each StyledLabel in the footer to the corresponding | |
81 // LegalMessageLine. Weak references. | |
82 std::map<views::StyledLabel*, | |
83 const SaveCardBubbleController::LegalMessageLine*> | |
84 legal_message_lines_; | |
Evan Stade
2015/11/17 19:38:19
I don't really think you need this map, the info i
bondd
2015/11/17 23:48:58
Done.
| |
85 | |
70 views::Link* learn_more_link_; | 86 views::Link* learn_more_link_; |
71 | 87 |
72 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); | 88 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); |
73 }; | 89 }; |
74 | 90 |
75 } // namespace autofill | 91 } // namespace autofill |
76 | 92 |
77 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 93 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
OLD | NEW |