| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/ui/views/validation_message_bubble_delegate.h" | 5 #include "chrome/browser/ui/views/validation_message_bubble_delegate.h" |
| 6 | 6 |
| 7 #include "grit/theme_resources.h" | 7 #include "grit/theme_resources.h" |
| 8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
| 9 #include "ui/views/controls/image_view.h" | 9 #include "ui/views/controls/image_view.h" |
| 10 #include "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 sub_label->GetHeightForWidth(label_width)); | 72 sub_label->GetHeightForWidth(label_width)); |
| 73 content_bottom += kTextVerticalMargin + sub_label->height(); | 73 content_bottom += kTextVerticalMargin + sub_label->height(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 width_ = text_start_x + label_width + kPadding; | 76 width_ = text_start_x + label_width + kPadding; |
| 77 height_ = content_bottom + kPadding; | 77 height_ = content_bottom + kPadding; |
| 78 } | 78 } |
| 79 | 79 |
| 80 ValidationMessageBubbleDelegate::~ValidationMessageBubbleDelegate() {} | 80 ValidationMessageBubbleDelegate::~ValidationMessageBubbleDelegate() {} |
| 81 | 81 |
| 82 void ValidationMessageBubbleDelegate::Hide() { | 82 void ValidationMessageBubbleDelegate::Close() { |
| 83 GetWidget()->Hide(); | 83 GetWidget()->Close(); |
| 84 observer_ = NULL; | 84 observer_ = NULL; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ValidationMessageBubbleDelegate::SetPositionRelativeToAnchor( |
| 88 const gfx::Rect& anchor_in_screen) { |
| 89 set_anchor_rect(anchor_in_screen); |
| 90 GetWidget()->SetBounds(GetBubbleBounds()); |
| 91 } |
| 92 |
| 87 gfx::Size ValidationMessageBubbleDelegate::GetPreferredSize() { | 93 gfx::Size ValidationMessageBubbleDelegate::GetPreferredSize() { |
| 88 return gfx::Size(width_, height_); | 94 return gfx::Size(width_, height_); |
| 89 } | 95 } |
| 90 | 96 |
| 91 void ValidationMessageBubbleDelegate::DeleteDelegate() { | 97 void ValidationMessageBubbleDelegate::DeleteDelegate() { |
| 92 delete this; | 98 delete this; |
| 93 } | 99 } |
| 94 | 100 |
| 95 void ValidationMessageBubbleDelegate::WindowClosing() { | 101 void ValidationMessageBubbleDelegate::WindowClosing() { |
| 96 if (observer_ != NULL) | 102 if (observer_ != NULL) |
| 97 observer_->WindowClosing(); | 103 observer_->WindowClosing(); |
| 98 } | 104 } |
| OLD | NEW |