new_credit_card_bubble_views.h revision ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16
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#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_NEW_CREDIT_CARD_BUBBLE_VIEWS_H_
6#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_NEW_CREDIT_CARD_BUBBLE_VIEWS_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "base/memory/weak_ptr.h"
11#include "chrome/browser/ui/autofill/new_credit_card_bubble_view.h"
12#include "ui/views/bubble/bubble_delegate.h"
13#include "ui/views/controls/link_listener.h"
14
15namespace autofill {
16
17class NewCreditCardBubbleController;
18
19// Views toolkit implementation of NewCreditCardBubbleView (a bubble shown after
20// a user saved a new card locally in Chrome).
21class NewCreditCardBubbleViews : public NewCreditCardBubbleView,
22                                 public views::BubbleDelegateView,
23                                 public views::LinkListener {
24 public:
25  virtual ~NewCreditCardBubbleViews();
26
27  // NewCreditCardBubbleView:
28  virtual void Show() OVERRIDE;
29  virtual void Hide() OVERRIDE;
30
31  // views::BubbleDelegateView:
32  virtual gfx::Size GetPreferredSize() OVERRIDE;
33  virtual base::string16 GetWindowTitle() const OVERRIDE;
34  virtual void Init() OVERRIDE;
35
36  // views::LinkListener:
37  virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
38
39 private:
40  friend base::WeakPtr<NewCreditCardBubbleView> NewCreditCardBubbleView::Create(
41      NewCreditCardBubbleController* controller);
42
43  explicit NewCreditCardBubbleViews(
44     NewCreditCardBubbleController* controller);
45
46  // Controller that drives this bubble. Never NULL; outlives this class.
47  NewCreditCardBubbleController* controller_;
48
49  base::WeakPtrFactory<NewCreditCardBubbleView> weak_ptr_factory_;
50
51  DISALLOW_COPY_AND_ASSIGN(NewCreditCardBubbleViews);
52};
53
54}  // namespace autofill
55
56#endif  // CHROME_BROWSER_UI_VIEWS_AUTOFILL_NEW_CREDIT_CARD_BUBBLE_VIEWS_H_
57