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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 end_link.is_link = true; | 216 end_link.is_link = true; |
217 contents_text_ranges_.push_back(end_link); | 217 contents_text_ranges_.push_back(end_link); |
218 | 218 |
219 UpdateAnchor(); | 219 UpdateAnchor(); |
220 | 220 |
221 if (ShouldDisplayBubbleInitially()) | 221 if (ShouldDisplayBubbleInitially()) |
222 Show(false); | 222 Show(false); |
223 } | 223 } |
224 | 224 |
225 void GeneratedCreditCardBubbleController::Show(bool was_anchor_click) { | 225 void GeneratedCreditCardBubbleController::Show(bool was_anchor_click) { |
| 226 Hide(); |
| 227 |
226 if (!CanShow()) | 228 if (!CanShow()) |
227 return; | 229 return; |
228 | 230 |
229 bubble_ = CreateBubble(); | 231 bubble_ = CreateBubble(); |
230 if (!bubble_) { | 232 if (!bubble_) { |
231 // TODO(dbeam): Make a bubble on all applicable platforms. | 233 // TODO(dbeam): Make a bubble on all applicable platforms. |
232 return; | 234 return; |
233 } | 235 } |
234 | 236 |
235 bubble_->Show(); | 237 bubble_->Show(); |
(...skipping 13 matching lines...) Expand all Loading... |
249 if (browser && browser->window() && browser->window()->GetLocationBar()) | 251 if (browser && browser->window() && browser->window()->GetLocationBar()) |
250 browser->window()->GetLocationBar()->UpdateGeneratedCreditCardView(); | 252 browser->window()->GetLocationBar()->UpdateGeneratedCreditCardView(); |
251 } | 253 } |
252 | 254 |
253 void GeneratedCreditCardBubbleController::Hide() { | 255 void GeneratedCreditCardBubbleController::Hide() { |
254 if (bubble_ && !bubble_->IsHiding()) | 256 if (bubble_ && !bubble_->IsHiding()) |
255 bubble_->Hide(); | 257 bubble_->Hide(); |
256 } | 258 } |
257 | 259 |
258 } // namespace autofill | 260 } // namespace autofill |
OLD | NEW |