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

Unified Diff: ui/views/bubble/tray_bubble_view.cc

Issue 2901273003: chromeos: Remove TrayBubbleView::Delegate::OnBeforeBubbleWidgetInit (Closed)
Patch Set: nit Created 3 years, 7 months 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 | « ui/views/bubble/tray_bubble_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/tray_bubble_view.cc
diff --git a/ui/views/bubble/tray_bubble_view.cc b/ui/views/bubble/tray_bubble_view.cc
index 6d29a97d269cd9c8261e0c02a1715daddcbba10c..a7657e9ceaf7cf0bbde4274c7963eeded7865489 100644
--- a/ui/views/bubble/tray_bubble_view.cc
+++ b/ui/views/bubble/tray_bubble_view.cc
@@ -171,33 +171,16 @@ class BottomAlignedBoxLayout : public BoxLayout {
using internal::TrayBubbleContentMask;
using internal::BottomAlignedBoxLayout;
-TrayBubbleView::InitParams::InitParams(AnchorAlignment anchor_alignment,
- int min_width,
- int max_width)
- : anchor_alignment(anchor_alignment),
- min_width(min_width),
- max_width(max_width),
- max_height(0),
- can_activate(false),
- close_on_deactivate(true) {}
+TrayBubbleView::InitParams::InitParams() = default;
TrayBubbleView::InitParams::InitParams(const InitParams& other) = default;
-// static
-TrayBubbleView* TrayBubbleView::Create(View* anchor,
- Delegate* delegate,
- InitParams* init_params) {
- return new TrayBubbleView(anchor, delegate, *init_params);
-}
-
-TrayBubbleView::TrayBubbleView(View* anchor,
- Delegate* delegate,
- const InitParams& init_params)
- : BubbleDialogDelegateView(anchor,
+TrayBubbleView::TrayBubbleView(const InitParams& init_params)
+ : BubbleDialogDelegateView(init_params.anchor_view,
GetArrowAlignment(init_params.anchor_alignment)),
params_(init_params),
layout_(new BottomAlignedBoxLayout(this)),
- delegate_(delegate),
+ delegate_(init_params.delegate),
preferred_width_(init_params.min_width),
bubble_border_(new BubbleBorder(
arrow(),
@@ -206,11 +189,14 @@ TrayBubbleView::TrayBubbleView(View* anchor,
owned_bubble_border_(bubble_border_),
is_gesture_dragging_(false),
mouse_actively_entered_(false) {
+ DCHECK(delegate_);
+ DCHECK(params_.parent_window);
+ DCHECK(anchor_widget()); // Computed by BubbleDialogDelegateView().
bubble_border_->set_use_theme_background_color(!init_params.bg_color);
bubble_border_->set_alignment(BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE);
bubble_border_->set_paint_arrow(BubbleBorder::PAINT_NONE);
+ set_parent_window(params_.parent_window);
set_can_activate(params_.can_activate);
- DCHECK(anchor_widget()); // Computed by BubbleDialogDelegateView().
set_notify_enter_exit_on_child(true);
set_close_on_deactivate(init_params.close_on_deactivate);
set_margins(gfx::Insets());
@@ -283,8 +269,6 @@ int TrayBubbleView::GetDialogButtons() const {
void TrayBubbleView::OnBeforeBubbleWidgetInit(Widget::InitParams* params,
Widget* bubble_widget) const {
- if (delegate_)
- delegate_->OnBeforeBubbleWidgetInit(anchor_widget(), bubble_widget, params);
// Apply a WM-provided shadow (see ui/wm/core/).
params->shadow_type = Widget::InitParams::SHADOW_TYPE_DROP;
params->shadow_elevation = wm::ShadowElevation::LARGE;
« no previous file with comments | « ui/views/bubble/tray_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698