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_COCOA_AUTOFILL_GENERATED_CREDIT_CARD_BUBBLE_COCOA_H_
6#define CHROME_BROWSER_UI_COCOA_AUTOFILL_GENERATED_CREDIT_CARD_BUBBLE_COCOA_H_
7
8#include "base/mac/scoped_nsobject.h"
9#include "chrome/browser/ui/autofill/generated_credit_card_bubble_view.h"
10
11#ifdef __OBJC__
12@class GeneratedCreditCardBubbleControllerCocoa;
13#else
14class GeneratedCreditCardBubbleControllerCocoa;
15#endif
16
17namespace autofill {
18
19class GeneratedCreditCardBubbleCocoa : public GeneratedCreditCardBubbleView {
20 public:
21  virtual ~GeneratedCreditCardBubbleCocoa();
22
23  // GeneratedCreditCardBubbleView interface.
24  virtual void Show() OVERRIDE;
25  virtual void Hide() OVERRIDE;
26  virtual bool IsHiding() const OVERRIDE;
27
28  // Callbacks.
29  void OnBubbleClosing();
30  void OnLinkClicked();
31
32  base::WeakPtr<GeneratedCreditCardBubbleController> controller() {
33    return controller_;
34  }
35
36 private:
37  explicit GeneratedCreditCardBubbleCocoa(
38      const base::WeakPtr<GeneratedCreditCardBubbleController>& controller);
39  friend base::WeakPtr<GeneratedCreditCardBubbleView>
40      GeneratedCreditCardBubbleView::Create(
41          const base::WeakPtr<GeneratedCreditCardBubbleController>& controller);
42
43  // Cocoa-side controller for the bubble. Not owned.
44  GeneratedCreditCardBubbleControllerCocoa* bubbleController_;
45
46  // Controller that drives this bubble. May be invalid when hiding.
47  base::WeakPtr<GeneratedCreditCardBubbleController> controller_;
48
49  // Factory to vend WeakPtr's to |this|.
50  base::WeakPtrFactory<GeneratedCreditCardBubbleCocoa> weak_ptr_factory_;
51
52  DISALLOW_COPY_AND_ASSIGN(GeneratedCreditCardBubbleCocoa);
53};
54
55}  // namespace autofill
56
57#endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_GENERATED_CREDIT_CARD_BUBBLE_COCOA_H_
58
59