OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_ |
7 | 7 |
8 #include "chrome/browser/views/info_bubble.h" | 8 #include "chrome/browser/views/info_bubble.h" |
9 #include "views/controls/button/button.h" | 9 #include "views/controls/button/button.h" |
10 #include "views/view.h" | 10 #include "views/view.h" |
| 11 #include "views/widget/widget_gtk.h" |
11 | 12 |
12 class SkBitmap; | 13 class SkBitmap; |
13 | 14 |
14 namespace views { | 15 namespace views { |
15 class ImageButton; | 16 class ImageButton; |
16 class ImageView; | 17 class ImageView; |
17 class Label; | 18 class Label; |
18 } | 19 } |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 | 22 |
22 // MessageBubble is used to show error and info messages on OOBE screens. | 23 // MessageBubble is used to show error and info messages on OOBE screens. |
23 class MessageBubble : public InfoBubble, | 24 class MessageBubble : public InfoBubble, |
24 public views::ButtonListener { | 25 public views::ButtonListener { |
25 public: | 26 public: |
26 // Create and show bubble. position_relative_to must be in screen coordinates. | 27 // Create and show bubble. position_relative_to must be in screen coordinates. |
27 static MessageBubble* Show(views::Widget* parent, | 28 static MessageBubble* Show(views::Widget* parent, |
28 const gfx::Rect& position_relative_to, | 29 const gfx::Rect& position_relative_to, |
29 BubbleBorder::ArrowLocation arrow_location, | 30 BubbleBorder::ArrowLocation arrow_location, |
30 SkBitmap* image, | 31 SkBitmap* image, |
31 const std::wstring& text, | 32 const std::wstring& text, |
32 InfoBubbleDelegate* delegate); | 33 InfoBubbleDelegate* delegate); |
33 | 34 |
34 // Overridden from WidgetWin | 35 // Create and show bubble which does not grab pointer. This creates |
| 36 // a TYPE_CHILD WidgetGtk and |position_relative_to| must be in parent's |
| 37 // coordinates. |
| 38 static MessageBubble* ShowNoGrab(views::Widget* parent, |
| 39 const gfx::Rect& position_relative_to, |
| 40 BubbleBorder::ArrowLocation arrow_location, |
| 41 SkBitmap* image, |
| 42 const std::wstring& text, |
| 43 InfoBubbleDelegate* delegate); |
| 44 |
| 45 // Overridden from WidgetGtk. |
35 virtual void Close(); | 46 virtual void Close(); |
36 | 47 |
37 protected: | 48 protected: |
| 49 |
| 50 // views::ButtonListener implmenets. |
38 virtual void ButtonPressed(views::Button* sender, | 51 virtual void ButtonPressed(views::Button* sender, |
39 const views::Event& event); | 52 const views::Event& event); |
40 | 53 |
| 54 // Overridden from WidgetGtk. |
41 virtual void IsActiveChanged(); | 55 virtual void IsActiveChanged(); |
| 56 virtual void DoGrab(); |
42 | 57 |
43 private: | 58 private: |
44 MessageBubble(views::Widget* parent, SkBitmap* image, | 59 MessageBubble(views::WidgetGtk::Type type, |
45 const std::wstring& text); | 60 views::Widget* parent, SkBitmap* image, |
| 61 const std::wstring& text, bool grab_enabled); |
46 | 62 |
47 views::Widget* parent_; | 63 views::Widget* parent_; |
48 views::ImageView* icon_; | 64 views::ImageView* icon_; |
49 views::Label* text_; | 65 views::Label* text_; |
50 views::ImageButton* close_button_; | 66 views::ImageButton* close_button_; |
| 67 bool grab_enabled_; |
51 | 68 |
52 DISALLOW_COPY_AND_ASSIGN(MessageBubble); | 69 DISALLOW_COPY_AND_ASSIGN(MessageBubble); |
53 }; | 70 }; |
54 | 71 |
55 } // namespace chromeos | 72 } // namespace chromeos |
56 | 73 |
57 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_ |
OLD | NEW |