Chromium Code Reviews| Index: chrome/browser/chromeos/login/message_bubble.h |
| diff --git a/chrome/browser/chromeos/login/message_bubble.h b/chrome/browser/chromeos/login/message_bubble.h |
| index 250121233aa459c60765c116a27d1986bde9774d..6823dceb4eea9a83db4b6baa98fd0061c6a89b7c 100644 |
| --- a/chrome/browser/chromeos/login/message_bubble.h |
| +++ b/chrome/browser/chromeos/login/message_bubble.h |
| @@ -9,111 +9,63 @@ |
| #include <vector> |
| #include "base/basictypes.h" |
| -#include "base/compiler_specific.h" |
| -#include "chrome/browser/ui/views/bubble/bubble.h" |
| +#include "ui/views/bubble/bubble_delegate.h" |
| #include "views/controls/button/button.h" |
| #include "views/controls/link_listener.h" |
| -#include "views/view.h" |
| - |
| -#if defined(TOOLKIT_USES_GTK) |
| -#include "ui/views/widget/native_widget_gtk.h" |
| -#endif |
| class SkBitmap; |
| namespace views { |
| class ImageButton; |
| -class ImageView; |
| -class Label; |
| } |
| namespace chromeos { |
| -class MessageBubbleDelegate : public BubbleDelegate { |
| +class MessageBubbleLinkListener { |
| public: |
| - // Called when the user clicked on help link. |
| - // |index| identifies which link was clicked if there's more than one. |
| + // Called when the user clicks on help link. |
| + // |index| identifies which link was clicked in case there's more than one. |
| virtual void OnLinkActivated(size_t index) = 0; |
| }; |
| // MessageBubble is used to show error and info messages on OOBE screens. |
| -class MessageBubble : public Bubble, |
| +class MessageBubble : public views::BubbleDelegateView, |
| public views::ButtonListener, |
| public views::LinkListener { |
| public: |
| - // Create and show bubble. position_relative_to must be in screen coordinates. |
| - // |links| is an optional vector of links texts. |
| - static MessageBubble* Show(views::Widget* parent, |
| - const gfx::Rect& position_relative_to, |
| - views::BubbleBorder::ArrowLocation arrow_location, |
| - SkBitmap* image, |
| - const std::wstring& text, |
| - const std::wstring& help, |
| - MessageBubbleDelegate* delegate); |
| - |
| - // Create and show bubble. position_relative_to must be in screen coordinates. |
| - // |links| is an optional vector of links texts. |
| - static MessageBubble* ShowWithLinks( |
| - views::Widget* parent, |
| - const gfx::Rect& position_relative_to, |
| - views::BubbleBorder::ArrowLocation arrow_location, |
| - SkBitmap* image, |
| - const std::wstring& text, |
| - const std::vector<std::wstring>& links, |
| - MessageBubbleDelegate* delegate); |
| - |
| - // Create and show bubble which does not grab pointer. This creates |
| - // a TYPE_CHILD NativeWidgetGtk and |position_relative_to| must be in parent's |
| - // coordinates. |
| - static MessageBubble* ShowNoGrab( |
| - views::Widget* parent, |
| - const gfx::Rect& position_relative_to, |
| - views::BubbleBorder::ArrowLocation arrow_location, |
| - SkBitmap* image, |
| - const std::wstring& text, |
| - const std::wstring& help, |
| - MessageBubbleDelegate* delegate); |
| - |
| - // Overridden from NativeWidgetGtk/NativeWidgetViews. |
| - virtual void Close() OVERRIDE; |
| - |
| -#if !defined(TOUCH_UI) && defined(TOOLKIT_USES_GTK) |
| - virtual gboolean OnButtonPress(GtkWidget* widget, |
| - GdkEventButton* event) OVERRIDE; |
| -#endif |
| + MessageBubble(views::View* anchor_view, |
| + views::BubbleBorder::ArrowLocation arrow_location, |
| + SkBitmap* image, |
| + const string16& text, |
| + const std::vector<string16>& links); |
| - protected: |
| virtual ~MessageBubble(); |
| + // Show the bubble. |
| + static void ShowBubble(MessageBubble* bubble); |
|
Dmitry Polukhin
2011/11/23 12:44:35
I think there is no sense to make it static and pa
msw
2011/11/29 00:11:07
Removed, message bubble call sites now call browse
|
| + |
| + void set_link_listener(MessageBubbleLinkListener* link_listener) { |
| + link_listener_ = link_listener; |
| + } |
| + |
| + protected: |
| + |
| + // Overridden from views::BubbleDelegateView: |
| + virtual void Init() OVERRIDE; |
| + |
| // Overridden from views::ButtonListener: |
| virtual void ButtonPressed(views::Button* sender, |
| - const views::Event& event); |
| + const views::Event& event) OVERRIDE; |
| // Overridden from views::LinkListener: |
| virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
| -#if !defined(TOUCH_UI) && defined(TOOLKIT_USES_GTK) |
| - // Overridden from NativeWidgetGtk. |
| - virtual void OnActiveChanged() OVERRIDE; |
| - virtual void SetMouseCapture() OVERRIDE; |
| -#endif |
| - |
| private: |
| - MessageBubble(views::Widget::InitParams::Type type, |
| - views::Widget* parent, |
| - SkBitmap* image, |
| - const std::wstring& text, |
| - const std::vector<std::wstring>& links, |
| - bool grab_enabled, |
| - MessageBubbleDelegate* delegate); |
| - |
| - views::Widget* parent_; |
| - views::ImageView* icon_; |
| - views::Label* text_; |
| + SkBitmap* image_; |
| + string16 text_; |
| views::ImageButton* close_button_; |
| std::vector<views::Link*> help_links_; |
| - MessageBubbleDelegate* message_delegate_; |
| - bool grab_enabled_; |
| + MessageBubbleLinkListener* link_listener_; |
| DISALLOW_COPY_AND_ASSIGN(MessageBubble); |
| }; |