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/strings/string16.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/views/bubble/bubble_border.h"
15 class BubbleDelegateView
;
21 // PopupMessage shows a message to the user. Since the user is not able to
22 // dismiss it, the calling code needs to explictly close and destroy it.
23 class ASH_EXPORT PopupMessage
{
30 // Creates a message pointing towards |anchor| with the requested
31 // |arrow_orientation|. The message contains an optional |caption| which is
32 // drawn in bold and an optional |message| together with an optional icon of
33 // shape |message_type|. If a component in |size_override| is not 0 the value
34 // is the used as output size. If |arrow_offset| is not 0, the number is the
35 // arrow offset in pixels from the border.
37 // Here is the layout (arrow given as TOP_LEFT):
42 // +-------------------------------------------------+
44 // icon | [!] Caption in bold which can be multi line | caption_label
46 // | Message text which can be multi line | message_label
49 // +-------------------------------------------------+
50 PopupMessage(const base::string16
& caption
,
51 const base::string16
& message
,
52 IconType message_type
,
54 views::BubbleBorder::Arrow arrow
,
55 const gfx::Size
& size_override
,
57 // If the message was not explicitly closed before, it closes the message
59 virtual ~PopupMessage();
61 // Closes the message with a fade out animation.
67 void CancelHidingAnimation();
70 views::Widget
* widget_
;
72 // Variables of the construction time.
74 base::string16 caption_
;
75 base::string16 message_
;
76 IconType message_type_
;
77 views::BubbleBorder::Arrow arrow_orientation_
;
79 DISALLOW_COPY_AND_ASSIGN(PopupMessage
);
84 #endif // ASH_POPUP_MESSAGE_H_