Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / location_bar / generated_credit_card_decoration.h
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_LOCATION_BAR_GENERATED_CREDIT_CARD_DECORATION_H_
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_GENERATED_CREDIT_CARD_DECORATION_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #include "base/basictypes.h"
11 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h"
12
13 class LocationBarViewMac;
14
15 namespace autofill {
16 class GeneratedCreditCardBubbleController;
17 }
18
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 {
23  public:
24   explicit GeneratedCreditCardDecoration(LocationBarViewMac* owner);
25   ~GeneratedCreditCardDecoration() override;
26
27   // Called when this decoration should update its visible status.
28   void Update();
29
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;
36
37  private:
38   // Helper to get the GeneratedCreditCardBubbleController associated with the
39   // current web contents.
40   autofill::GeneratedCreditCardBubbleController* GetController() const;
41
42   // The control that owns this. Weak.
43   LocationBarViewMac* owner_;
44
45   DISALLOW_COPY_AND_ASSIGN(GeneratedCreditCardDecoration);
46 };
47
48 #endif  // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_GENERATED_CREDIT_CARD_DECORATION_H_
49