generated_credit_card_view.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_LOCATION_BAR_GENERATED_CREDIT_CARD_VIEW_H_
6#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_GENERATED_CREDIT_CARD_VIEW_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h"
11#include "chrome/browser/ui/views/location_bar/location_bar_decoration_view.h"
12#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
13#include "ui/views/controls/image_view.h"
14
15class ToolbarModel;
16
17namespace autofill {
18class GeneratedCreditCardBubbleController;
19}
20
21////////////////////////////////////////////////////////////////////////////////
22//
23// GeneratedCreditCardView
24//
25//  An icon that shows up in the omnibox after successfully generating a credit
26//  card number. Used as an anchor and click target to show the associated
27//  bubble with more details about the credit cards saved or used.
28//
29////////////////////////////////////////////////////////////////////////////////
30class GeneratedCreditCardView : public LocationBarDecorationView {
31 public:
32  GeneratedCreditCardView(ToolbarModel* toolbar_model,
33                         LocationBarView::Delegate* delegate);
34  virtual ~GeneratedCreditCardView();
35
36  void Update();
37
38 protected:
39  // LocationBarDecorationView:
40  virtual bool CanHandleClick() const OVERRIDE;
41  virtual void OnClick() OVERRIDE;
42
43 private:
44  // Helper to get the GeneratedCreditCardBubbleController associated with the
45  // current web contents.
46  autofill::GeneratedCreditCardBubbleController* GetController() const;
47
48  ToolbarModel* toolbar_model_;  // weak; outlives us.
49  LocationBarView::Delegate* delegate_;  // weak; outlives us.
50
51  DISALLOW_COPY_AND_ASSIGN(GeneratedCreditCardView);
52};
53
54#endif  // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_GENERATED_CREDIT_CARD_VIEW_H_
55