OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bubble_delegate.h" | 5 #include "ui/views/bubble/bubble_delegate.h" |
6 | 6 |
7 #include "ui/base/animation/slide_animation.h" | 7 #include "ui/base/animation/slide_animation.h" |
8 #include "ui/gfx/color_utils.h" | 8 #include "ui/gfx/color_utils.h" |
9 #include "ui/views/bubble/bubble_frame_view.h" | 9 #include "ui/views/bubble/bubble_frame_view.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { | 174 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { |
175 return this; | 175 return this; |
176 } | 176 } |
177 | 177 |
178 View* BubbleDelegateView::GetContentsView() { | 178 View* BubbleDelegateView::GetContentsView() { |
179 return this; | 179 return this; |
180 } | 180 } |
181 | 181 |
182 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( | 182 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( |
183 Widget* widget) { | 183 Widget* widget) { |
184 return new BubbleFrameView(arrow_location(), color(), margins()); | 184 BubbleFrameView* frame_view = new BubbleFrameView(margins()); |
msw
2012/07/23 22:20:49
What's wrong with the current construction pattern
| |
185 BubbleBorder::ArrowLocation arrow_loc = arrow_location(); | |
186 if (base::i18n::IsRTL()) | |
187 arrow_loc = BubbleBorder::horizontal_mirror(arrow_loc); | |
msw
2012/07/23 22:20:49
Why add this new arrow mirroring here?
stevenjb
2012/07/23 23:32:06
This was previously in the constructor.
| |
188 // TODO(alicet): Expose the shadow option in BorderContentsView when we make | |
189 // the fullscreen exit bubble use the new bubble code. | |
190 BubbleBorder* bubble_border = | |
191 new BubbleBorder(arrow_loc, BubbleBorder::NO_SHADOW); | |
192 bubble_border->set_background_color(color()); | |
193 frame_view->SetBubbleBorder(bubble_border); | |
194 frame_view->set_background(new BubbleBackground(bubble_border)); | |
195 return frame_view; | |
185 } | 196 } |
186 | 197 |
187 void BubbleDelegateView::OnWidgetClosing(Widget* widget) { | 198 void BubbleDelegateView::OnWidgetClosing(Widget* widget) { |
188 if (anchor_widget() == widget) { | 199 if (anchor_widget() == widget) { |
189 anchor_view_ = NULL; | 200 anchor_view_ = NULL; |
190 anchor_widget_ = NULL; | 201 anchor_widget_ = NULL; |
191 } | 202 } |
192 } | 203 } |
193 | 204 |
194 void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget, | 205 void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 | 338 |
328 #if defined(OS_WIN) && !defined(USE_AURA) | 339 #if defined(OS_WIN) && !defined(USE_AURA) |
329 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 340 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
330 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 341 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
331 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); | 342 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); |
332 return client_bounds; | 343 return client_bounds; |
333 } | 344 } |
334 #endif | 345 #endif |
335 | 346 |
336 } // namespace views | 347 } // namespace views |
OLD | NEW |