Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: chrome/browser/ui/views/autofill/info_bubble.h

Issue 55243005: Implement learn more bubble on views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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_AUTOFILL_INFO_BUBBLE_H_
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_INFO_BUBBLE_H_
7
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"
13
14 namespace autofill {
15
16 // Class to create and manage an information bubble for errors or tooltips.
17 class InfoBubble : public views::BubbleDelegateView {
18 public:
19 InfoBubble(views::View* anchor, const base::string16& message);
20 virtual ~InfoBubble();
21
22 // Shows the bubble. |widget_| will be NULL until this is called.
23 void Show();
24
25 // Hides and closes the bubble.
26 void Hide();
27
28 // Updates the position of the bubble.
29 void UpdatePosition();
30
31 // views::BubbleDelegateView:
32 virtual gfx::Size GetPreferredSize() OVERRIDE;
33 virtual gfx::Rect GetBubbleBounds() OVERRIDE;
34 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
35 virtual bool ShouldFlipArrowForRtl() const OVERRIDE;
36
37 views::View* anchor() { return anchor_; }
38
39 void set_align_to_anchor_edge(bool align_to_anchor_edge) {
40 align_to_anchor_edge_ = align_to_anchor_edge;
41 }
42
43 void set_container_insets(const gfx::Insets& container_insets) {
44 container_insets_ = container_insets;
45 }
46
47 void set_preferred_width(int preferred_width) {
48 preferred_width_ = preferred_width;
49 }
50
51 void set_show_above_anchor(bool show_above_anchor) {
52 show_above_anchor_ = show_above_anchor;
53 }
54
55 private:
56 // Whether the bubble should stick to the right edge of |anchor_|.
57 bool ShouldArrowGoOnTheRight();
58
59 views::Widget* widget_; // Weak, may be NULL.
60 views::View* const anchor_; // Weak.
61
62 // Whether the bubble should align its border to the anchor's edge rather than
63 // horizontally centering the arrow on |anchor_|'s midpoint. Default is false.
64 bool align_to_anchor_edge_;
65
66 // Shrinks the container's size when calculating whether the arrow should be
67 // on the right or left side of the bubble.
68 gfx::Insets container_insets_;
69
70 // The width this bubble prefers to be. Default is 0 (no preference).
71 int preferred_width_;
72
73 // Whether the bubble should be shown above the anchor (default is below).
74 bool show_above_anchor_;
75
76 DISALLOW_COPY_AND_ASSIGN(InfoBubble);
77 };
78
79 } // namespace autofill
80
81 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_INFO_BUBBLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autofill/decorated_textfield.cc ('k') | chrome/browser/ui/views/autofill/info_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698