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

Unified Diff: ash/popup_message.h

Issue 15329005: Adding new general bubble error message consisting of icon, message and caption. Using this message… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git status Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/ash.gyp ('k') | ash/popup_message.cc » ('j') | ash/popup_message.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/popup_message.h
diff --git a/ash/popup_message.h b/ash/popup_message.h
new file mode 100644
index 0000000000000000000000000000000000000000..d994548b7dfa50ff8ed289252f8c2508f3b27deb
--- /dev/null
+++ b/ash/popup_message.h
@@ -0,0 +1,71 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
James Cook 2013/05/22 12:29:07 nit: new code does not need the "(c)" in the copyr
Mr4D (OOO till 08-26) 2013/05/22 14:57:34 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_POPUP_MESSAGE_H_
+#define ASH_POPUP_MESSAGE_H_
+
+#include "ash/ash_export.h"
+#include "base/basictypes.h"
+#include "base/string16.h"
+#include "ui/gfx/rect.h"
+#include "ui/views/bubble/bubble_border.h"
+#include "ui/views/bubble/bubble_delegate.h"
James Cook 2013/05/22 12:29:07 Is this include needed?
Mr4D (OOO till 08-26) 2013/05/22 14:57:34 Done.
+
+namespace views {
+class BubbleDelegateView;
+}
+
+namespace ash {
+
+// PopupMessage shows a message to the user. Since the user is not able to
+// dismiss it, the calling code needs to explictly close and destroy it.
+class ASH_EXPORT PopupMessage {
+ public:
+ enum IconType {
+ ICON_WARNING,
+ ICON_NONE
+ };
+
+ // Creates a message pointing towards |anchor| with the requested
+ // |arrow_orientation|. The message contains an optional |caption| which is
+ // drawn in bold and an optional |message| together with an optional icon of
+ // shape |message_type|. If a component in |size_override| is not 0 the value
+ // is the used as output size. If |arrow_offset| is not 0, the number is the
+ // arrow offset in pixels from the border.
James Cook 2013/05/22 12:29:07 Hooray for detailed function comments!
Mr4D (OOO till 08-26) 2013/05/22 14:57:34 You are welcome! Added also the layout with what t
+ PopupMessage(const base::string16& caption,
+ const base::string16& message,
+ IconType message_type,
+ views::View* anchor,
+ views::BubbleBorder::Arrow arrow,
+ const gfx::Size& size_override,
+ int arrow_offset);
+ // If the message was not explicitly closed before, it closes the message
+ // without animation.
+ virtual ~PopupMessage();
+
+ // Closes the message with a fade out animation.
+ void Close();
+
+ private:
+ class MessageBubble;
+
+ void CancelHidingAnimation();
+
+ MessageBubble* view_;
+ views::Widget* widget_;
+
+ // Variables of the construction time.
+ views::View* anchor_;
+ base::string16 caption_;
+ base::string16 message_;
+ IconType message_type_;
+ views::BubbleBorder::Arrow arrow_orientation_;
+
James Cook 2013/05/22 12:29:07 only one blank line needed
Mr4D (OOO till 08-26) 2013/05/22 14:57:34 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(PopupMessage);
+};
+
+} // namespace ash
+
+#endif // ASH_POPUP_MESSAGE_H_
« no previous file with comments | « ash/ash.gyp ('k') | ash/popup_message.cc » ('j') | ash/popup_message.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698