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_COCOA_LOCATION_BAR_GENERATED_CREDIT_CARD_DECORATION_H_
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_GENERATED_CREDIT_CARD_DECORATION_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/basictypes.h"
11 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h"
13 class LocationBarViewMac;
16 class GeneratedCreditCardBubbleController;
19 // An icon that shows up in the omnibox after successfully generating a credit
20 // card number. Used as an anchor and click target to show the associated
21 // bubble with more details about the credit cards saved or used.
22 class GeneratedCreditCardDecoration : public ImageDecoration {
24 explicit GeneratedCreditCardDecoration(LocationBarViewMac* owner);
25 ~GeneratedCreditCardDecoration() override;
27 // Called when this decoration should update its visible status.
30 // Implement |LocationBarDecoration|.
31 // N.B. - this is identical to LocationBarDecorationView's OnClick
32 // and canHandleClick.
33 bool AcceptsMousePress() override;
34 bool OnMousePressed(NSRect frame, NSPoint location) override;
35 NSPoint GetBubblePointInFrame(NSRect frame) override;
38 // Helper to get the GeneratedCreditCardBubbleController associated with the
39 // current web contents.
40 autofill::GeneratedCreditCardBubbleController* GetController() const;
42 // The control that owns this. Weak.
43 LocationBarViewMac* owner_;
45 DISALLOW_COPY_AND_ASSIGN(GeneratedCreditCardDecoration);
48 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_GENERATED_CREDIT_CARD_DECORATION_H_