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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_GENERATED_CREDIT_CARD_BUBBLE_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_GENERATED_CREDIT_CARD_BUBBLE_VIEWS_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_view.h"
12 #include "ui/views/bubble/bubble_delegate.h"
13 #include "ui/views/controls/styled_label_listener.h"
17 class GeneratedCreditCardBubbleController
;
19 // Views toolkit implementation of the GeneratedCreditCardBubbleView (an
20 // educational bubble shown after a successful generation of a new credit card
22 class GeneratedCreditCardBubbleViews
: public GeneratedCreditCardBubbleView
,
23 public views::BubbleDelegateView
,
24 public views::StyledLabelListener
{
26 virtual ~GeneratedCreditCardBubbleViews();
28 // GeneratedCreditCardBubbleView:
29 virtual void Show() OVERRIDE
;
30 virtual void Hide() OVERRIDE
;
31 virtual bool IsHiding() const OVERRIDE
;
33 // views::BubbleDelegateView:
34 virtual gfx::Size
GetPreferredSize() OVERRIDE
;
35 virtual base::string16
GetWindowTitle() const OVERRIDE
;
36 virtual void Init() OVERRIDE
;
38 // views::StyledLabelListener:
39 virtual void StyledLabelLinkClicked(const ui::Range
& range
, int event_flags
)
43 friend base::WeakPtr
<GeneratedCreditCardBubbleView
>
44 GeneratedCreditCardBubbleView::Create(
45 const base::WeakPtr
<GeneratedCreditCardBubbleController
>& controller
);
47 explicit GeneratedCreditCardBubbleViews(
48 const base::WeakPtr
<GeneratedCreditCardBubbleController
>& controller
);
50 // Controller that drives this bubble. May be invalid when hiding.
51 base::WeakPtr
<GeneratedCreditCardBubbleController
> controller_
;
53 base::WeakPtrFactory
<GeneratedCreditCardBubbleView
> weak_ptr_factory_
;
55 DISALLOW_COPY_AND_ASSIGN(GeneratedCreditCardBubbleViews
);
58 } // namespace autofill
60 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_GENERATED_CREDIT_CARD_BUBBLE_VIEWS_H_