| Index: chrome/browser/ui/views/validation_message_bubble_view.cc
|
| diff --git a/chrome/browser/ui/views/validation_message_bubble_view.cc b/chrome/browser/ui/views/validation_message_bubble_view.cc
|
| index 076cba008f02e996523b872a0b40cf973bffc46c..f4685d8d99bc8884afa99573485c62bf7cda0ed4 100644
|
| --- a/chrome/browser/ui/views/validation_message_bubble_view.cc
|
| +++ b/chrome/browser/ui/views/validation_message_bubble_view.cc
|
| @@ -4,15 +4,58 @@
|
|
|
| #include "chrome/browser/ui/validation_message_bubble.h"
|
|
|
| +#include "chrome/browser/ui/views/validation_message_bubble_delegate.h"
|
| +#include "ui/views/widget/widget.h"
|
| +
|
| +namespace {
|
| +
|
| +// A ValidationMessageBubble implementation for Views.
|
| +class ValidationMessageBubbleImpl
|
| + : public chrome::ValidationMessageBubble,
|
| + public ValidationMessageBubbleDelegate::Observer {
|
| + public:
|
| + ValidationMessageBubbleImpl(const gfx::Rect& anchor_in_screen,
|
| + const string16& main_text,
|
| + const string16& sub_text);
|
| +
|
| + virtual ~ValidationMessageBubbleImpl() {
|
| + if (delegate_ != NULL)
|
| + delegate_->Hide();
|
| + }
|
| +
|
| + // ValidationMessageBubbleDelegate::Observer override:
|
| + virtual void WindowClosing() OVERRIDE {
|
| + delegate_ = NULL;
|
| + }
|
| +
|
| + private:
|
| + ValidationMessageBubbleDelegate* delegate_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ValidationMessageBubbleImpl);
|
| +};
|
| +
|
| +ValidationMessageBubbleImpl::ValidationMessageBubbleImpl(
|
| + const gfx::Rect& anchor_in_screen,
|
| + const string16& main_text,
|
| + const string16& sub_text) {
|
| + delegate_ = new ValidationMessageBubbleDelegate(
|
| + anchor_in_screen, main_text, sub_text, this);
|
| + views::BubbleDelegateView::CreateBubble(delegate_);
|
| + delegate_->GetWidget()->Show();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| namespace chrome {
|
|
|
| scoped_ptr<ValidationMessageBubble> ValidationMessageBubble::CreateAndShow(
|
| - content::RenderWidgetHost* widget_host,
|
| + content::RenderWidgetHost*,
|
| const gfx::Rect& anchor_in_screen,
|
| const string16& main_text,
|
| const string16& sub_text) {
|
| - // TODO(tkent): Implement this and enable it. crbug.com/235719.
|
| - return scoped_ptr<ValidationMessageBubble>().Pass();
|
| + scoped_ptr<ValidationMessageBubble> bubble(
|
| + new ValidationMessageBubbleImpl(anchor_in_screen, main_text, sub_text));
|
| + return bubble.Pass();
|
| }
|
|
|
| -}
|
| +} // namespace chrome
|
|
|