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

Side by Side Diff: chrome/browser/chromeos/login/message_bubble.h

Issue 3201003: Fixed error message bubbles according to the latest mocks (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Comments resolved Created 10 years, 4 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
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/views/info_bubble.h" 9 #include "chrome/browser/views/info_bubble.h"
10 #include "views/controls/button/button.h" 10 #include "views/controls/button/button.h"
11 #include "views/controls/link.h"
11 #include "views/view.h" 12 #include "views/view.h"
12 #include "views/widget/widget_gtk.h" 13 #include "views/widget/widget_gtk.h"
13 14
14 class SkBitmap; 15 class SkBitmap;
15 16
16 namespace views { 17 namespace views {
17 class ImageButton; 18 class ImageButton;
18 class ImageView; 19 class ImageView;
19 class Label; 20 class Label;
20 } 21 }
21 22
22 namespace chromeos { 23 namespace chromeos {
23 24
25 class MessageBubbleDelegate : public InfoBubbleDelegate {
26 public:
27 // Called when the user clicked on help link.
28 virtual void OnHelpLinkActivated() = 0;
29 };
30
24 // MessageBubble is used to show error and info messages on OOBE screens. 31 // MessageBubble is used to show error and info messages on OOBE screens.
25 class MessageBubble : public InfoBubble, 32 class MessageBubble : public InfoBubble,
26 public views::ButtonListener { 33 public views::ButtonListener,
34 public views::LinkController {
27 public: 35 public:
28 // Create and show bubble. position_relative_to must be in screen coordinates. 36 // Create and show bubble. position_relative_to must be in screen coordinates.
29 static MessageBubble* Show(views::Widget* parent, 37 static MessageBubble* Show(views::Widget* parent,
30 const gfx::Rect& position_relative_to, 38 const gfx::Rect& position_relative_to,
31 BubbleBorder::ArrowLocation arrow_location, 39 BubbleBorder::ArrowLocation arrow_location,
32 SkBitmap* image, 40 SkBitmap* image,
33 const std::wstring& text, 41 const std::wstring& text,
34 InfoBubbleDelegate* delegate); 42 const std::wstring& help,
43 MessageBubbleDelegate* delegate);
35 44
36 // Create and show bubble which does not grab pointer. This creates 45 // Create and show bubble which does not grab pointer. This creates
37 // a TYPE_CHILD WidgetGtk and |position_relative_to| must be in parent's 46 // a TYPE_CHILD WidgetGtk and |position_relative_to| must be in parent's
38 // coordinates. 47 // coordinates.
39 static MessageBubble* ShowNoGrab(views::Widget* parent, 48 static MessageBubble* ShowNoGrab(views::Widget* parent,
40 const gfx::Rect& position_relative_to, 49 const gfx::Rect& position_relative_to,
41 BubbleBorder::ArrowLocation arrow_location, 50 BubbleBorder::ArrowLocation arrow_location,
42 SkBitmap* image, 51 SkBitmap* image,
43 const std::wstring& text, 52 const std::wstring& text,
44 InfoBubbleDelegate* delegate); 53 const std::wstring& help,
54 MessageBubbleDelegate* delegate);
45 55
46 // Overridden from WidgetGtk. 56 // Overridden from WidgetGtk.
47 virtual void Close(); 57 virtual void Close();
48 58
49 virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event) { 59 virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event) {
50 WidgetGtk::OnButtonPress(widget, event); 60 WidgetGtk::OnButtonPress(widget, event);
51 // Never propagate event to parent. 61 // Never propagate event to parent.
52 return true; 62 return true;
53 } 63 }
54 64
55 protected: 65 protected:
56 // views::ButtonListener implmenets. 66 // Overridden from views::ButtonListener:
57 virtual void ButtonPressed(views::Button* sender, 67 virtual void ButtonPressed(views::Button* sender,
58 const views::Event& event); 68 const views::Event& event);
59 69
70 // Overridden from views::LinkController:
71 virtual void LinkActivated(views::Link* source, int event_flags);
72
60 // Overridden from WidgetGtk. 73 // Overridden from WidgetGtk.
61 virtual void IsActiveChanged(); 74 virtual void IsActiveChanged();
62 virtual void DoGrab(); 75 virtual void DoGrab();
63 76
64 private: 77 private:
65 MessageBubble(views::WidgetGtk::Type type, 78 MessageBubble(views::WidgetGtk::Type type,
66 views::Widget* parent, SkBitmap* image, 79 views::Widget* parent,
67 const std::wstring& text, bool grab_enabled); 80 SkBitmap* image,
81 const std::wstring& text,
82 const std::wstring& help,
83 bool grab_enabled,
84 MessageBubbleDelegate* delegate);
68 85
69 views::Widget* parent_; 86 views::Widget* parent_;
70 views::ImageView* icon_; 87 views::ImageView* icon_;
71 views::Label* text_; 88 views::Label* text_;
72 views::ImageButton* close_button_; 89 views::ImageButton* close_button_;
90 views::Link* help_link_;
91 MessageBubbleDelegate* message_delegate_;
73 bool grab_enabled_; 92 bool grab_enabled_;
74 93
75 DISALLOW_COPY_AND_ASSIGN(MessageBubble); 94 DISALLOW_COPY_AND_ASSIGN(MessageBubble);
76 }; 95 };
77 96
78 } // namespace chromeos 97 } // namespace chromeos
79 98
80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_ 99 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MESSAGE_BUBBLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_screen.cc ('k') | chrome/browser/chromeos/login/message_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698