[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / autofill / info_bubble.h
blobd02820573ba1eeffe3ea66e6a06411979f107ae4
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_VIEWS_AUTOFILL_INFO_BUBBLE_H_
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_INFO_BUBBLE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/strings/string16.h"
11 #include "ui/gfx/insets.h"
12 #include "ui/views/bubble/bubble_delegate.h"
14 namespace autofill {
16 class InfoBubbleFrame;
18 // Class to create and manage an information bubble for errors or tooltips.
19 class InfoBubble : public views::BubbleDelegateView {
20 public:
21 InfoBubble(views::View* anchor, const base::string16& message);
22 virtual ~InfoBubble();
24 // Shows the bubble. |widget_| will be NULL until this is called.
25 void Show();
27 // Hides and closes the bubble.
28 void Hide();
30 // Updates the position of the bubble.
31 void UpdatePosition();
33 // views::BubbleDelegateView:
34 virtual views::NonClientFrameView* CreateNonClientFrameView(
35 views::Widget* widget) OVERRIDE;
36 virtual gfx::Size GetPreferredSize() const OVERRIDE;
37 virtual void OnWidgetDestroyed(views::Widget* widget) OVERRIDE;
38 virtual void OnWidgetBoundsChanged(views::Widget* widget,
39 const gfx::Rect& new_bounds) OVERRIDE;
41 views::View* anchor() { return anchor_; }
42 const views::View* anchor() const { return anchor_; }
44 void set_align_to_anchor_edge(bool align_to_anchor_edge) {
45 align_to_anchor_edge_ = align_to_anchor_edge;
48 void set_preferred_width(int preferred_width) {
49 preferred_width_ = preferred_width;
52 void set_show_above_anchor(bool show_above_anchor) {
53 show_above_anchor_ = show_above_anchor;
56 private:
57 views::Widget* widget_; // Weak, may be NULL.
58 views::View* const anchor_; // Weak.
59 InfoBubbleFrame* frame_; // Weak, owned by widget.
61 // Whether the bubble should align its border to the anchor's edge rather than
62 // horizontally centering the arrow on |anchor_|'s midpoint. Default is false.
63 bool align_to_anchor_edge_;
65 // The width this bubble prefers to be. Default is 0 (no preference).
66 int preferred_width_;
68 // Whether the bubble should be shown above the anchor (default is below).
69 bool show_above_anchor_;
71 DISALLOW_COPY_AND_ASSIGN(InfoBubble);
74 } // namespace autofill
76 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_INFO_BUBBLE_H_