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"
16 class BubbleDelegateView
;
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
{
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):
43 // +-------------------------------------------------+
45 // icon | [!] Caption in bold which can be multi line | caption_label
47 // | Message text which can be multi line | message_label
50 // +-------------------------------------------------+
51 PopupMessage(const base::string16
& caption
,
52 const base::string16
& message
,
53 IconType message_type
,
55 views::BubbleBorder::Arrow arrow
,
56 const gfx::Size
& size_override
,
58 // If the message was not explicitly closed before, it closes the message
60 virtual ~PopupMessage();
62 // Closes the message with a fade out animation.
66 FRIEND_TEST_ALL_PREFIXES(PopupMessageTest
, Layout
);
70 static const int kCaptionLabelID
;
71 static const int kMessageLabelID
;
73 void CancelHidingAnimation();
76 views::Widget
* widget_
;
78 base::string16 caption_
;
79 base::string16 message_
;
81 DISALLOW_COPY_AND_ASSIGN(PopupMessage
);
86 #endif // ASH_POPUP_MESSAGE_H_