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

Unified Diff: views/bubble/bubble_delegate.cc

Issue 8508048: Rebase PageInfoBubble on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge, indent a line. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/bubble/bubble_delegate.cc
diff --git a/views/bubble/bubble_delegate.cc b/views/bubble/bubble_delegate.cc
index 517878df3462c18eb75179c6cb519ead705740f6..b3baea4b2096a8708ef33fc04336a972a1154820 100644
--- a/views/bubble/bubble_delegate.cc
+++ b/views/bubble/bubble_delegate.cc
@@ -109,22 +109,20 @@ BubbleDelegateView::~BubbleDelegateView() {
// static
Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) {
bubble_delegate->Init();
- Widget* parent_widget = bubble_delegate->anchor_view() ?
+ Widget* parent = bubble_delegate->anchor_view() ?
bubble_delegate->anchor_view()->GetWidget() : NULL;
- Widget* bubble_widget = CreateBubbleWidget(bubble_delegate, parent_widget);
+ Widget* bubble_widget = CreateBubbleWidget(bubble_delegate, parent);
#if defined(OS_WIN) && !defined(USE_AURA)
// First set the contents view to initialize view bounds for widget sizing.
bubble_widget->SetContentsView(bubble_delegate->GetContentsView());
- bubble_delegate->InitializeBorderWidget(parent_widget);
- bubble_widget->SetBounds(bubble_delegate->GetBubbleClientBounds());
-#else
- bubble_widget->SetBounds(bubble_delegate->GetBubbleBounds());
+ bubble_delegate->border_widget_ = CreateBorderWidget(bubble_delegate, parent);
#endif
+ bubble_delegate->SizeToContents();
bubble_widget->AddObserver(bubble_delegate);
- if (parent_widget && parent_widget->GetTopLevelWidget())
- parent_widget->GetTopLevelWidget()->DisableInactiveRendering();
+ if (parent && parent->GetTopLevelWidget())
+ parent->GetTopLevelWidget()->DisableInactiveRendering();
return bubble_widget;
}
@@ -223,10 +221,9 @@ bool BubbleDelegateView::AcceleratorPressed(
return true;
}
-void BubbleDelegateView::Init() {}
-
void BubbleDelegateView::AnimationEnded(const ui::Animation* animation) {
- DCHECK_EQ(animation, fade_animation_.get());
+ if (animation != fade_animation_.get())
+ return;
bool closed = fade_animation_->GetCurrentValue() == 0;
fade_animation_->Reset();
if (closed)
@@ -234,7 +231,8 @@ void BubbleDelegateView::AnimationEnded(const ui::Animation* animation) {
}
void BubbleDelegateView::AnimationProgressed(const ui::Animation* animation) {
- DCHECK_EQ(animation, fade_animation_.get());
+ if (animation != fade_animation_.get())
+ return;
DCHECK(fade_animation_->is_animating());
unsigned char opacity = fade_animation_->GetCurrentValue() * 255;
#if defined(OS_WIN) && !defined(USE_AURA)
@@ -255,6 +253,17 @@ void BubbleDelegateView::AnimationProgressed(const ui::Animation* animation) {
SchedulePaint();
}
+void BubbleDelegateView::Init() {}
+
+void BubbleDelegateView::SizeToContents() {
+#if defined(OS_WIN) && !defined(USE_AURA)
+ border_widget_->SetBounds(GetBubbleBounds());
+ GetWidget()->SetBounds(GetBubbleClientBounds());
+#else
+ GetWidget()->SetBounds(GetBubbleBounds());
+#endif
+}
+
BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const {
const Widget* widget = border_widget_ ? border_widget_ : GetWidget();
return static_cast<BubbleFrameView*>(widget->non_client_view()->frame_view());
@@ -268,11 +277,6 @@ gfx::Rect BubbleDelegateView::GetBubbleBounds() {
}
#if defined(OS_WIN) && !defined(USE_AURA)
-void BubbleDelegateView::InitializeBorderWidget(Widget* parent_widget) {
- border_widget_ = CreateBorderWidget(this, parent_widget);
- border_widget_->SetBounds(GetBubbleBounds());
-}
-
gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const {
gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView());
client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin());
« no previous file with comments | « views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698