OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/views/bubble/info_bubble.h" | 5 #include "ui/views/bubble/info_bubble.h" |
6 | 6 |
7 #include "ui/gfx/geometry/point.h" | 7 #include "ui/gfx/geometry/point.h" |
8 #include "ui/gfx/geometry/rect.h" | 8 #include "ui/gfx/geometry/rect.h" |
9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 | 79 |
80 NonClientFrameView* InfoBubble::CreateNonClientFrameView(Widget* widget) { | 80 NonClientFrameView* InfoBubble::CreateNonClientFrameView(Widget* widget) { |
81 DCHECK(!frame_); | 81 DCHECK(!frame_); |
82 frame_ = new InfoBubbleFrame(margins()); | 82 frame_ = new InfoBubbleFrame(margins()); |
83 frame_->set_available_bounds(anchor_widget()->GetWindowBoundsInScreen()); | 83 frame_->set_available_bounds(anchor_widget()->GetWindowBoundsInScreen()); |
84 frame_->SetBubbleBorder(std::unique_ptr<BubbleBorder>( | 84 frame_->SetBubbleBorder(std::unique_ptr<BubbleBorder>( |
85 new BubbleBorder(arrow(), shadow(), color()))); | 85 new BubbleBorder(arrow(), shadow(), color()))); |
86 return frame_; | 86 return frame_; |
87 } | 87 } |
88 | 88 |
89 gfx::Size InfoBubble::GetPreferredSize() const { | 89 gfx::Size InfoBubble::GetUnsnappedPreferredSize() const { |
90 if (preferred_width_ == 0) | 90 if (preferred_width_ == 0) |
91 return BubbleDialogDelegateView::GetPreferredSize(); | 91 return BubbleDialogDelegateView::GetPreferredSize(); |
Peter Kasting
2017/03/30 00:35:36
I think this causes an infinite loop. Has to be V
| |
92 | 92 |
93 int pref_width = preferred_width_; | 93 int pref_width = preferred_width_; |
94 pref_width -= frame_->GetInsets().width(); | 94 pref_width -= frame_->GetInsets().width(); |
95 pref_width -= 2 * kBubbleBorderVisibleWidth; | 95 pref_width -= 2 * kBubbleBorderVisibleWidth; |
96 return gfx::Size(pref_width, GetHeightForWidth(pref_width)); | 96 return gfx::Size(pref_width, GetHeightForWidth(pref_width)); |
97 } | 97 } |
98 | 98 |
99 void InfoBubble::OnWidgetDestroyed(Widget* widget) { | 99 void InfoBubble::OnWidgetDestroyed(Widget* widget) { |
100 if (widget == widget_) | 100 if (widget == widget_) |
101 widget_ = nullptr; | 101 widget_ = nullptr; |
(...skipping 18 matching lines...) Expand all Loading... | |
120 SizeToContents(); | 120 SizeToContents(); |
121 widget_->SetVisibilityChangedAnimationsEnabled(true); | 121 widget_->SetVisibilityChangedAnimationsEnabled(true); |
122 widget_->ShowInactive(); | 122 widget_->ShowInactive(); |
123 } else { | 123 } else { |
124 widget_->SetVisibilityChangedAnimationsEnabled(false); | 124 widget_->SetVisibilityChangedAnimationsEnabled(false); |
125 widget_->Hide(); | 125 widget_->Hide(); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 } // namespace views | 129 } // namespace views |
OLD | NEW |