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

Side by Side Diff: ash/common/popup_message.h

Issue 2684313004: Additional cleanup of pre-md system menu user row code. (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/popup_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ASH_COMMON_POPUP_MESSAGE_H_
6 #define ASH_COMMON_POPUP_MESSAGE_H_
7
8 #include "ash/ash_export.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/macros.h"
11 #include "base/strings/string16.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/views/bubble/bubble_border.h"
14
15 namespace views {
16 class Widget;
17 }
18
19 namespace ash {
20
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 {
24 public:
25 enum IconType { ICON_WARNING, ICON_NONE };
26
27 // Creates a message pointing towards |anchor| with the requested
28 // |arrow_orientation|. The message contains an optional |caption| which is
29 // drawn in bold and an optional |message| together with an optional icon of
30 // shape |message_type|. If a component in |size_override| is not 0 the value
31 // is the used as output size. If |arrow_offset| is not 0, the number is the
32 // arrow offset in pixels from the border.
33 //
34 // Here is the layout (arrow given as TOP_LEFT):
35 // |--------|
36 // | Anchor |
37 // |--------|
38 // |-arrow_offset---^
39 // +-------------------------------------------------+
40 // -| |-
41 // icon | [!] Caption in bold which can be multi line | caption_label
42 // -| |-
43 // | Message text which can be multi line | message_label
44 // | as well. |
45 // | |-
46 // +-------------------------------------------------+
47 PopupMessage(const base::string16& caption,
48 const base::string16& message,
49 IconType message_type,
50 views::View* anchor,
51 views::BubbleBorder::Arrow arrow,
52 const gfx::Size& size_override,
53 int arrow_offset);
54 // If the message was not explicitly closed before, it closes the message
55 // without animation.
56 virtual ~PopupMessage();
57
58 // Closes the message with a fade out animation.
59 void Close();
60
61 private:
62 FRIEND_TEST_ALL_PREFIXES(PopupMessageTest, Layout);
63
64 class MessageBubble;
65
66 static const int kCaptionLabelID;
67 static const int kMessageLabelID;
68
69 void CancelHidingAnimation();
70
71 MessageBubble* view_;
72 views::Widget* widget_;
73
74 base::string16 caption_;
75 base::string16 message_;
76
77 DISALLOW_COPY_AND_ASSIGN(PopupMessage);
78 };
79
80 } // namespace ash
81
82 #endif // ASH_COMMON_POPUP_MESSAGE_H_
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/popup_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698