| Index: chrome/browser/chromeos/login/message_bubble.cc
|
| diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc
|
| index 3c69f892e2c978e1c63ace3cab08d92d61456321..82cb775b5282a5ca3fee9f7b28c4991de4758865 100644
|
| --- a/chrome/browser/chromeos/login/message_bubble.cc
|
| +++ b/chrome/browser/chromeos/login/message_bubble.cc
|
| @@ -19,10 +19,17 @@ namespace chromeos {
|
| static const int kBorderSize = 4;
|
| static const int kMaxLabelWidth = 250;
|
|
|
| -MessageBubble::MessageBubble(views::WidgetGtk::Type type, views::Widget* parent,
|
| - SkBitmap* image, const std::wstring& text, bool grab_enabled)
|
| +MessageBubble::MessageBubble(views::WidgetGtk::Type type,
|
| + views::Widget* parent,
|
| + SkBitmap* image,
|
| + const std::wstring& text,
|
| + const std::wstring& help,
|
| + bool grab_enabled,
|
| + MessageBubbleDelegate* delegate)
|
| : InfoBubble(type),
|
| parent_(parent),
|
| + help_link_(NULL),
|
| + message_delegate_(delegate),
|
| grab_enabled_(grab_enabled) {
|
| using views::GridLayout;
|
|
|
| @@ -38,6 +45,12 @@ MessageBubble::MessageBubble(views::WidgetGtk::Type type, views::Widget* parent,
|
| column_set->AddPaddingColumn(0, kBorderSize);
|
| column_set->AddColumn(GridLayout::TRAILING, GridLayout::LEADING, 0,
|
| GridLayout::USE_PREF, 0, 0);
|
| + if (!help.empty()) {
|
| + column_set = layout->AddColumnSet(1);
|
| + column_set->AddPaddingColumn(0, kBorderSize + image->width());
|
| + column_set->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 1,
|
| + GridLayout::USE_PREF, 0, 0);
|
| + }
|
|
|
| ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
|
|
| @@ -60,6 +73,13 @@ MessageBubble::MessageBubble(views::WidgetGtk::Type type, views::Widget* parent,
|
| close_button_->SetImage(views::CustomButton::BS_PUSHED,
|
| rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
|
| layout->AddView(close_button_);
|
| +
|
| + if (!help.empty()) {
|
| + layout->StartRowWithPadding(0, 1, 0, kBorderSize);
|
| + help_link_ = new views::Link(help);
|
| + help_link_->SetController(this);
|
| + layout->AddView(help_link_);
|
| + }
|
| }
|
|
|
| void MessageBubble::ButtonPressed(views::Button* sender,
|
| @@ -71,16 +91,26 @@ void MessageBubble::ButtonPressed(views::Button* sender,
|
| }
|
| }
|
|
|
| +void MessageBubble::LinkActivated(views::Link* source, int event_flags) {
|
| + if (source == help_link_) {
|
| + if (message_delegate_)
|
| + message_delegate_->OnHelpLinkActivated();
|
| + } else {
|
| + NOTREACHED() << "Unknown view";
|
| + }
|
| +}
|
| +
|
| // static
|
| MessageBubble* MessageBubble::Show(views::Widget* parent,
|
| const gfx::Rect& position_relative_to,
|
| BubbleBorder::ArrowLocation arrow_location,
|
| SkBitmap* image,
|
| const std::wstring& text,
|
| - InfoBubbleDelegate* delegate) {
|
| + const std::wstring& help,
|
| + MessageBubbleDelegate* delegate) {
|
| // The bubble will be destroyed when it is closed.
|
| MessageBubble* bubble = new MessageBubble(
|
| - views::WidgetGtk::TYPE_WINDOW, parent, image, text, true);
|
| + views::WidgetGtk::TYPE_WINDOW, parent, image, text, help, true, delegate);
|
| bubble->Init(parent, position_relative_to, arrow_location,
|
| bubble->text_->GetParent(), delegate);
|
| return bubble;
|
| @@ -93,10 +123,11 @@ MessageBubble* MessageBubble::ShowNoGrab(
|
| BubbleBorder::ArrowLocation arrow_location,
|
| SkBitmap* image,
|
| const std::wstring& text,
|
| - InfoBubbleDelegate* delegate) {
|
| + const std::wstring& help,
|
| + MessageBubbleDelegate* delegate) {
|
| // The bubble will be destroyed when it is closed.
|
| MessageBubble* bubble = new MessageBubble(
|
| - views::WidgetGtk::TYPE_CHILD, parent, image, text, false);
|
| + views::WidgetGtk::TYPE_CHILD, parent, image, text, help, false, delegate);
|
| bubble->Init(parent, position_relative_to, arrow_location,
|
| bubble->text_->GetParent(), delegate);
|
| return bubble;
|
|
|