OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/views/autofill/generated_credit_card_bubble_views.h" | 5 #include "chrome/browser/ui/views/autofill/generated_credit_card_bubble_views.h" |
6 | 6 |
7 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" | 7 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 style = views::StyledLabel::RangeStyleInfo::CreateForLink(); | 85 style = views::StyledLabel::RangeStyleInfo::CreateForLink(); |
86 else | 86 else |
87 style.font_style = gfx::Font::BOLD; | 87 style.font_style = gfx::Font::BOLD; |
88 | 88 |
89 contents->AddStyleRange(text_ranges[i].range, style); | 89 contents->AddStyleRange(text_ranges[i].range, style); |
90 } | 90 } |
91 | 91 |
92 AddChildView(contents); | 92 AddChildView(contents); |
93 } | 93 } |
94 | 94 |
95 void GeneratedCreditCardBubbleViews::StyledLabelLinkClicked(const ui::Range& r, | 95 void GeneratedCreditCardBubbleViews::StyledLabelLinkClicked(const gfx::Range& r, |
96 int event_flags) { | 96 int event_flags) { |
97 if (controller_) | 97 if (controller_) |
98 controller_->OnLinkClicked(); | 98 controller_->OnLinkClicked(); |
99 } | 99 } |
100 | 100 |
101 // static | 101 // static |
102 base::WeakPtr<GeneratedCreditCardBubbleView> | 102 base::WeakPtr<GeneratedCreditCardBubbleView> |
103 GeneratedCreditCardBubbleView::Create( | 103 GeneratedCreditCardBubbleView::Create( |
104 const base::WeakPtr<GeneratedCreditCardBubbleController>& controller) { | 104 const base::WeakPtr<GeneratedCreditCardBubbleController>& controller) { |
105 return (new GeneratedCreditCardBubbleViews(controller))->weak_ptr_factory_. | 105 return (new GeneratedCreditCardBubbleViews(controller))->weak_ptr_factory_. |
106 GetWeakPtr(); | 106 GetWeakPtr(); |
107 } | 107 } |
108 | 108 |
109 GeneratedCreditCardBubbleViews::GeneratedCreditCardBubbleViews( | 109 GeneratedCreditCardBubbleViews::GeneratedCreditCardBubbleViews( |
110 const base::WeakPtr<GeneratedCreditCardBubbleController>& controller) | 110 const base::WeakPtr<GeneratedCreditCardBubbleController>& controller) |
111 : BubbleDelegateView(GetAnchor(controller), views::BubbleBorder::TOP_RIGHT), | 111 : BubbleDelegateView(GetAnchor(controller), views::BubbleBorder::TOP_RIGHT), |
112 controller_(controller), | 112 controller_(controller), |
113 weak_ptr_factory_(this) { | 113 weak_ptr_factory_(this) { |
114 gfx::Insets insets = views::BubbleFrameView::GetTitleInsets(); | 114 gfx::Insets insets = views::BubbleFrameView::GetTitleInsets(); |
115 set_margins(gfx::Insets(0, insets.left(), insets.top(), insets.left())); | 115 set_margins(gfx::Insets(0, insets.left(), insets.top(), insets.left())); |
116 } | 116 } |
117 | 117 |
118 void GeneratedCreditCardBubbleViews::ReleaseCapture() { | 118 void GeneratedCreditCardBubbleViews::ReleaseCapture() { |
119 GetWidget()->ReleaseCapture(); | 119 GetWidget()->ReleaseCapture(); |
120 } | 120 } |
121 | 121 |
122 } // namespace autofill | 122 } // namespace autofill |
OLD | NEW |