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/autofill/generated_credit_card_bubble_controller.h" | 5 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
6 | 6 |
7 #include <climits> | 7 #include <climits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 | 86 |
87 void GeneratedCreditCardBubbleController::DidNavigateMainFrame( | 87 void GeneratedCreditCardBubbleController::DidNavigateMainFrame( |
88 const content::LoadCommittedDetails& details, | 88 const content::LoadCommittedDetails& details, |
89 const content::FrameNavigateParams& params) { | 89 const content::FrameNavigateParams& params) { |
90 if (!details.entry) | 90 if (!details.entry) |
91 return; | 91 return; |
92 | 92 |
93 // Don't destory the bubble due to reloads, form submits, or redirects right | 93 // Don't destory the bubble due to reloads, form submits, or redirects right |
94 // after the dialog succeeds. Merchants often navigate to a confirmation page. | 94 // after the dialog succeeds. Merchants often navigate to a confirmation page. |
95 content::PageTransition transition = details.entry->GetTransitionType(); | 95 ui::PageTransition transition = details.entry->GetTransitionType(); |
96 if (transition == content::PAGE_TRANSITION_FORM_SUBMIT || | 96 if (transition == ui::PAGE_TRANSITION_FORM_SUBMIT || |
97 transition == content::PAGE_TRANSITION_RELOAD || | 97 transition == ui::PAGE_TRANSITION_RELOAD || |
98 content::PageTransitionIsRedirect(transition)) { | 98 ui::PageTransitionIsRedirect(transition)) { |
99 return; | 99 return; |
100 } | 100 } |
101 | 101 |
102 should_show_anchor_ = false; | 102 should_show_anchor_ = false; |
103 UpdateAnchor(); | 103 UpdateAnchor(); |
104 web_contents()->RemoveUserData(UserDataKey()); | 104 web_contents()->RemoveUserData(UserDataKey()); |
105 // |this| is now deleted. | 105 // |this| is now deleted. |
106 } | 106 } |
107 | 107 |
108 bool GeneratedCreditCardBubbleController::IsHiding() const { | 108 bool GeneratedCreditCardBubbleController::IsHiding() const { |
(...skipping 22 matching lines...) Expand all Loading... |
131 | 131 |
132 void GeneratedCreditCardBubbleController::OnAnchorClicked() { | 132 void GeneratedCreditCardBubbleController::OnAnchorClicked() { |
133 Show(true); | 133 Show(true); |
134 } | 134 } |
135 | 135 |
136 void GeneratedCreditCardBubbleController::OnLinkClicked() { | 136 void GeneratedCreditCardBubbleController::OnLinkClicked() { |
137 // Open a new tab to the Online Wallet help link. | 137 // Open a new tab to the Online Wallet help link. |
138 chrome::NavigateParams params( | 138 chrome::NavigateParams params( |
139 chrome::FindBrowserWithWebContents(web_contents()), | 139 chrome::FindBrowserWithWebContents(web_contents()), |
140 GURL(kWalletGeneratedCardLearnMoreLink), | 140 GURL(kWalletGeneratedCardLearnMoreLink), |
141 content::PAGE_TRANSITION_AUTO_BOOKMARK); | 141 ui::PAGE_TRANSITION_AUTO_BOOKMARK); |
142 params.disposition = NEW_FOREGROUND_TAB; | 142 params.disposition = NEW_FOREGROUND_TAB; |
143 chrome::Navigate(¶ms); | 143 chrome::Navigate(¶ms); |
144 | 144 |
145 Hide(); | 145 Hide(); |
146 } | 146 } |
147 | 147 |
148 base::WeakPtr<GeneratedCreditCardBubbleController> | 148 base::WeakPtr<GeneratedCreditCardBubbleController> |
149 GeneratedCreditCardBubbleController::GetWeakPtr() { | 149 GeneratedCreditCardBubbleController::GetWeakPtr() { |
150 return weak_ptr_factory_.GetWeakPtr(); | 150 return weak_ptr_factory_.GetWeakPtr(); |
151 } | 151 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (browser && browser->window() && browser->window()->GetLocationBar()) | 261 if (browser && browser->window() && browser->window()->GetLocationBar()) |
262 browser->window()->GetLocationBar()->UpdateGeneratedCreditCardView(); | 262 browser->window()->GetLocationBar()->UpdateGeneratedCreditCardView(); |
263 } | 263 } |
264 | 264 |
265 void GeneratedCreditCardBubbleController::Hide() { | 265 void GeneratedCreditCardBubbleController::Hide() { |
266 if (bubble_ && !bubble_->IsHiding()) | 266 if (bubble_ && !bubble_->IsHiding()) |
267 bubble_->Hide(); | 267 bubble_->Hide(); |
268 } | 268 } |
269 | 269 |
270 } // namespace autofill | 270 } // namespace autofill |
OLD | NEW |