Allow only one bookmark to be added for multiple fast starring
[chromium-blink-merge.git] / ash / popup_message.h
blobc2b160fa003e4553e388afa82e3004aae14410d2
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 ASH_POPUP_MESSAGE_H_
6 #define ASH_POPUP_MESSAGE_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/gtest_prod_util.h"
11 #include "base/strings/string16.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/views/bubble/bubble_border.h"
15 namespace views {
16 class BubbleDelegateView;
17 class Widget;
20 namespace ash {
22 // PopupMessage shows a message to the user. Since the user is not able to
23 // dismiss it, the calling code needs to explictly close and destroy it.
24 class ASH_EXPORT PopupMessage {
25 public:
26 enum IconType {
27 ICON_WARNING,
28 ICON_NONE
31 // Creates a message pointing towards |anchor| with the requested
32 // |arrow_orientation|. The message contains an optional |caption| which is
33 // drawn in bold and an optional |message| together with an optional icon of
34 // shape |message_type|. If a component in |size_override| is not 0 the value
35 // is the used as output size. If |arrow_offset| is not 0, the number is the
36 // arrow offset in pixels from the border.
38 // Here is the layout (arrow given as TOP_LEFT):
39 // |--------|
40 // | Anchor |
41 // |--------|
42 // |-arrow_offset---^
43 // +-------------------------------------------------+
44 // -| |-
45 // icon | [!] Caption in bold which can be multi line | caption_label
46 // -| |-
47 // | Message text which can be multi line | message_label
48 // | as well. |
49 // | |-
50 // +-------------------------------------------------+
51 PopupMessage(const base::string16& caption,
52 const base::string16& message,
53 IconType message_type,
54 views::View* anchor,
55 views::BubbleBorder::Arrow arrow,
56 const gfx::Size& size_override,
57 int arrow_offset);
58 // If the message was not explicitly closed before, it closes the message
59 // without animation.
60 virtual ~PopupMessage();
62 // Closes the message with a fade out animation.
63 void Close();
65 private:
66 FRIEND_TEST_ALL_PREFIXES(PopupMessageTest, Layout);
68 class MessageBubble;
70 static const int kCaptionLabelID;
71 static const int kMessageLabelID;
73 void CancelHidingAnimation();
75 MessageBubble* view_;
76 views::Widget* widget_;
78 base::string16 caption_;
79 base::string16 message_;
81 DISALLOW_COPY_AND_ASSIGN(PopupMessage);
84 } // namespace ash
86 #endif // ASH_POPUP_MESSAGE_H_