| 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/test_autofill_credit_card_bubble.h" | 5 #include "chrome/browser/ui/autofill/test_autofill_credit_card_bubble.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/autofill/autofill_credit_card_bubble_controller.h" |
| 8 |
| 7 namespace autofill { | 9 namespace autofill { |
| 8 | 10 |
| 9 // static | 11 // static |
| 10 base::WeakPtr<TestAutofillCreditCardBubble> | 12 base::WeakPtr<TestAutofillCreditCardBubble> |
| 11 TestAutofillCreditCardBubble::Create( | 13 TestAutofillCreditCardBubble::Create( |
| 12 const base::WeakPtr<AutofillCreditCardBubbleController>& controller) { | 14 const base::WeakPtr<AutofillCreditCardBubbleController>& controller) { |
| 13 return (new TestAutofillCreditCardBubble(controller))->GetWeakPtr(); | 15 return (new TestAutofillCreditCardBubble(controller))->GetWeakPtr(); |
| 14 } | 16 } |
| 15 | 17 |
| 16 TestAutofillCreditCardBubble::~TestAutofillCreditCardBubble() {} | 18 TestAutofillCreditCardBubble::~TestAutofillCreditCardBubble() { |
| 19 if (controller_) |
| 20 controller_->OnBubbleDestroyed(); |
| 21 } |
| 17 | 22 |
| 18 void TestAutofillCreditCardBubble::Show() { | 23 void TestAutofillCreditCardBubble::Show() { |
| 19 showing_ = true; | 24 showing_ = true; |
| 20 } | 25 } |
| 21 | 26 |
| 22 void TestAutofillCreditCardBubble::Hide() { | 27 void TestAutofillCreditCardBubble::Hide() { |
| 23 delete this; | 28 delete this; |
| 24 } | 29 } |
| 25 | 30 |
| 26 bool TestAutofillCreditCardBubble::IsHiding() const { | 31 bool TestAutofillCreditCardBubble::IsHiding() const { |
| 27 return !showing_; | 32 return !showing_; |
| 28 } | 33 } |
| 29 | 34 |
| 30 base::WeakPtr<TestAutofillCreditCardBubble> | 35 base::WeakPtr<TestAutofillCreditCardBubble> |
| 31 TestAutofillCreditCardBubble::GetWeakPtr() { | 36 TestAutofillCreditCardBubble::GetWeakPtr() { |
| 32 return weak_ptr_factory_.GetWeakPtr(); | 37 return weak_ptr_factory_.GetWeakPtr(); |
| 33 } | 38 } |
| 34 | 39 |
| 35 TestAutofillCreditCardBubble::TestAutofillCreditCardBubble( | 40 TestAutofillCreditCardBubble::TestAutofillCreditCardBubble( |
| 36 const base::WeakPtr<AutofillCreditCardBubbleController>& controller) | 41 const base::WeakPtr<AutofillCreditCardBubbleController>& controller) |
| 37 : showing_(false), | 42 : controller_(controller), |
| 43 showing_(false), |
| 38 weak_ptr_factory_(this) {} | 44 weak_ptr_factory_(this) {} |
| 39 | 45 |
| 40 } // namespace autofill | 46 } // namespace autofill |
| OLD | NEW |