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_view.h" | 9 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" |
10 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
11 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
12 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
| 13 #include "ui/views/controls/styled_label_listener.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class WebContents; | 16 class WebContents; |
16 } | 17 } |
17 | 18 |
18 namespace views { | 19 namespace views { |
19 class LabelButton; | 20 class LabelButton; |
20 class Link; | 21 class Link; |
| 22 class StyledLabel; |
21 } | 23 } |
22 | 24 |
23 namespace autofill { | 25 namespace autofill { |
24 | 26 |
25 class SaveCardBubbleController; | 27 class SaveCardBubbleController; |
26 | 28 |
27 // This class displays the "Save credit card?" bubble that is shown when the | 29 // 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 | 30 // user submits a form with a credit card number that Autofill has not |
29 // previously saved. | 31 // previously saved. |
30 class SaveCardBubbleViews : public SaveCardBubbleView, | 32 class SaveCardBubbleViews : public SaveCardBubbleView, |
31 public LocationBarBubbleDelegateView, | 33 public LocationBarBubbleDelegateView, |
32 public views::ButtonListener, | 34 public views::ButtonListener, |
33 public views::LinkListener { | 35 public views::LinkListener, |
| 36 public views::StyledLabelListener { |
34 public: | 37 public: |
35 // Bubble will be anchored to |anchor_view|. | 38 // Bubble will be anchored to |anchor_view|. |
36 SaveCardBubbleViews(views::View* anchor_view, | 39 SaveCardBubbleViews(views::View* anchor_view, |
37 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
38 SaveCardBubbleController* controller); | 41 SaveCardBubbleController* controller); |
39 | 42 |
40 // SaveCardBubbleView | 43 // SaveCardBubbleView |
41 void Show() override; | 44 void Show() override; |
42 void Close() override; | 45 void Close() override; |
43 void ControllerGone() override; | 46 void ControllerGone() override; |
44 | 47 |
45 // views::WidgetDelegate | 48 // views::WidgetDelegate |
46 views::View* GetInitiallyFocusedView() override; | 49 views::View* GetInitiallyFocusedView() override; |
47 base::string16 GetWindowTitle() const override; | 50 base::string16 GetWindowTitle() const override; |
48 bool ShouldShowWindowTitle() const override; | 51 bool ShouldShowWindowTitle() const override; |
49 void WindowClosing() override; | 52 void WindowClosing() override; |
50 | 53 |
51 // views::ButtonListener | 54 // views::ButtonListener |
52 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 55 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
53 | 56 |
54 // views::LinkListener | 57 // views::LinkListener |
55 void LinkClicked(views::Link* source, int event_flags) override; | 58 void LinkClicked(views::Link* source, int event_flags) override; |
56 | 59 |
| 60 // views::StyledLabelListener |
| 61 void StyledLabelLinkClicked(const gfx::Range& range, |
| 62 int event_flags) override; |
| 63 |
57 private: | 64 private: |
58 ~SaveCardBubbleViews() override; | 65 ~SaveCardBubbleViews() override; |
59 | 66 |
| 67 views::View* CreateMainContentView(); |
| 68 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 |
70 views::Link* learn_more_link_; | 80 views::Link* learn_more_link_; |
71 | 81 |
72 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); | 82 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleViews); |
73 }; | 83 }; |
74 | 84 |
75 } // namespace autofill | 85 } // namespace autofill |
76 | 86 |
77 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ | 87 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_SAVE_CARD_BUBBLE_VIEWS_H_ |
OLD | NEW |