diff options
author | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 23:06:56 +0000 |
---|---|---|
committer | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 23:06:56 +0000 |
commit | 45e0ff3b78fb3fea23b512b4e5632f86c302510a (patch) | |
tree | c9a674242661c4aee6965ca97cde925b01830215 /ash/popup_message.h | |
parent | f654244048abd59f49f1b6af64050fc80b34c55d (diff) | |
download | chromium_src-45e0ff3b78fb3fea23b512b4e5632f86c302510a.zip chromium_src-45e0ff3b78fb3fea23b512b4e5632f86c302510a.tar.gz chromium_src-45e0ff3b78fb3fea23b512b4e5632f86c302510a.tar.bz2 |
Adding new general bubble error message consisting of icon, message and caption. Using this message for the multi signin user error case.
There is still more to do: Unit tests & removal of test code. Beside that feature wise it is now fully functional as requested.
BUG=239201
TEST=visual, multiple scenarios
Review URL: https://chromiumcodereview.appspot.com/15329005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/popup_message.h')
-rw-r--r-- | ash/popup_message.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/ash/popup_message.h b/ash/popup_message.h new file mode 100644 index 0000000..76257cb --- /dev/null +++ b/ash/popup_message.h @@ -0,0 +1,83 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// 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" + +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. + // + // Here is the layout (arrow given as TOP_LEFT): + // |--------| + // | Anchor | + // |--------| + // |-arrow_offset---^ + // +-------------------------------------------------+ + // -| |- + // icon | [!] Caption in bold which can be multi line | caption_label + // -| |- + // | Message text which can be multi line | message_label + // | as well. | + // | |- + // +-------------------------------------------------+ + 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_; + + DISALLOW_COPY_AND_ASSIGN(PopupMessage); +}; + +} // namespace ash + +#endif // ASH_POPUP_MESSAGE_H_ |