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