| 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/tray_bubble_view.h" | 5 #include "ui/views/bubble/tray_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 TrayBubbleView::TrayBubbleView(View* anchor, | 189 TrayBubbleView::TrayBubbleView(View* anchor, |
| 190 Delegate* delegate, | 190 Delegate* delegate, |
| 191 const InitParams& init_params) | 191 const InitParams& init_params) |
| 192 : BubbleDialogDelegateView(anchor, | 192 : BubbleDialogDelegateView(anchor, |
| 193 GetArrowAlignment(init_params.anchor_alignment)), | 193 GetArrowAlignment(init_params.anchor_alignment)), |
| 194 params_(init_params), | 194 params_(init_params), |
| 195 layout_(new BottomAlignedBoxLayout(this)), | 195 layout_(new BottomAlignedBoxLayout(this)), |
| 196 delegate_(delegate), | 196 delegate_(delegate), |
| 197 preferred_width_(init_params.min_width), | 197 preferred_width_(init_params.min_width), |
| 198 bubble_border_(new BubbleBorder(arrow(), | 198 bubble_border_(new BubbleBorder(arrow(), |
| 199 BubbleBorder::BIG_SHADOW, | 199 BubbleBorder::NO_ASSETS, |
| 200 init_params.bg_color)), | 200 init_params.bg_color)), |
| 201 owned_bubble_border_(bubble_border_), | 201 owned_bubble_border_(bubble_border_), |
| 202 is_gesture_dragging_(false), | 202 is_gesture_dragging_(false), |
| 203 mouse_actively_entered_(false) { | 203 mouse_actively_entered_(false) { |
| 204 bubble_border_->set_alignment(BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 204 bubble_border_->set_alignment(BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 205 bubble_border_->set_paint_arrow(BubbleBorder::PAINT_NONE); | 205 bubble_border_->set_paint_arrow(BubbleBorder::PAINT_NONE); |
| 206 set_can_activate(params_.can_activate); | 206 set_can_activate(params_.can_activate); |
| 207 DCHECK(anchor_widget()); // Computed by BubbleDialogDelegateView(). | 207 DCHECK(anchor_widget()); // Computed by BubbleDialogDelegateView(). |
| 208 set_notify_enter_exit_on_child(true); | 208 set_notify_enter_exit_on_child(true); |
| 209 set_close_on_deactivate(init_params.close_on_deactivate); | 209 set_close_on_deactivate(init_params.close_on_deactivate); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 | 266 |
| 267 int TrayBubbleView::GetDialogButtons() const { | 267 int TrayBubbleView::GetDialogButtons() const { |
| 268 return ui::DIALOG_BUTTON_NONE; | 268 return ui::DIALOG_BUTTON_NONE; |
| 269 } | 269 } |
| 270 | 270 |
| 271 void TrayBubbleView::OnBeforeBubbleWidgetInit(Widget::InitParams* params, | 271 void TrayBubbleView::OnBeforeBubbleWidgetInit(Widget::InitParams* params, |
| 272 Widget* bubble_widget) const { | 272 Widget* bubble_widget) const { |
| 273 if (delegate_) | 273 if (delegate_) |
| 274 delegate_->OnBeforeBubbleWidgetInit(anchor_widget(), bubble_widget, params); | 274 delegate_->OnBeforeBubbleWidgetInit(anchor_widget(), bubble_widget, params); |
| 275 // Apply a WM-provided shadow (see ui/wm/core/). |
| 276 params->shadow_type = Widget::InitParams::SHADOW_TYPE_DROP; |
| 275 } | 277 } |
| 276 | 278 |
| 277 NonClientFrameView* TrayBubbleView::CreateNonClientFrameView(Widget* widget) { | 279 NonClientFrameView* TrayBubbleView::CreateNonClientFrameView(Widget* widget) { |
| 278 BubbleFrameView* frame = static_cast<BubbleFrameView*>( | 280 BubbleFrameView* frame = static_cast<BubbleFrameView*>( |
| 279 BubbleDialogDelegateView::CreateNonClientFrameView(widget)); | 281 BubbleDialogDelegateView::CreateNonClientFrameView(widget)); |
| 280 frame->SetBubbleBorder(std::move(owned_bubble_border_)); | 282 frame->SetBubbleBorder(std::move(owned_bubble_border_)); |
| 281 return frame; | 283 return frame; |
| 282 } | 284 } |
| 283 | 285 |
| 284 bool TrayBubbleView::WidgetHasHitTestMask() const { | 286 bool TrayBubbleView::WidgetHasHitTestMask() const { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 375 |
| 374 void TrayBubbleView::ViewHierarchyChanged( | 376 void TrayBubbleView::ViewHierarchyChanged( |
| 375 const ViewHierarchyChangedDetails& details) { | 377 const ViewHierarchyChangedDetails& details) { |
| 376 if (details.is_add && details.child == this) { | 378 if (details.is_add && details.child == this) { |
| 377 details.parent->SetPaintToLayer(true); | 379 details.parent->SetPaintToLayer(true); |
| 378 details.parent->layer()->SetMasksToBounds(true); | 380 details.parent->layer()->SetMasksToBounds(true); |
| 379 } | 381 } |
| 380 } | 382 } |
| 381 | 383 |
| 382 } // namespace views | 384 } // namespace views |
| OLD | NEW |