| 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 "ash/common/shelf/overflow_bubble_view.h" | 5 #include "ash/common/shelf/overflow_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm_lookup.h" | |
| 12 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 13 #include "ash/public/cpp/shell_window_ids.h" | 12 #include "ash/public/cpp/shell_window_ids.h" |
| 14 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
| 15 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
| 16 #include "ui/display/screen.h" | 15 #include "ui/display/screen.h" |
| 17 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
| 18 #include "ui/gfx/geometry/insets.h" | 17 #include "ui/gfx/geometry/insets.h" |
| 19 #include "ui/views/bubble/bubble_frame_view.h" | 18 #include "ui/views/bubble/bubble_frame_view.h" |
| 20 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 21 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 167 } |
| 169 | 168 |
| 170 int OverflowBubbleView::GetDialogButtons() const { | 169 int OverflowBubbleView::GetDialogButtons() const { |
| 171 return ui::DIALOG_BUTTON_NONE; | 170 return ui::DIALOG_BUTTON_NONE; |
| 172 } | 171 } |
| 173 | 172 |
| 174 void OverflowBubbleView::OnBeforeBubbleWidgetInit( | 173 void OverflowBubbleView::OnBeforeBubbleWidgetInit( |
| 175 views::Widget::InitParams* params, | 174 views::Widget::InitParams* params, |
| 176 views::Widget* bubble_widget) const { | 175 views::Widget* bubble_widget) const { |
| 177 // Place the bubble in the same root window as the anchor. | 176 // Place the bubble in the same root window as the anchor. |
| 178 WmLookup::Get() | 177 WmWindow::Get(anchor_widget()->GetNativeWindow()) |
| 179 ->GetWindowForWidget(anchor_widget()) | |
| 180 ->GetRootWindowController() | 178 ->GetRootWindowController() |
| 181 ->ConfigureWidgetInitParamsForContainer( | 179 ->ConfigureWidgetInitParamsForContainer( |
| 182 bubble_widget, kShellWindowId_ShelfBubbleContainer, params); | 180 bubble_widget, kShellWindowId_ShelfBubbleContainer, params); |
| 183 } | 181 } |
| 184 | 182 |
| 185 gfx::Rect OverflowBubbleView::GetBubbleBounds() { | 183 gfx::Rect OverflowBubbleView::GetBubbleBounds() { |
| 186 views::BubbleBorder* border = GetBubbleFrameView()->bubble_border(); | 184 views::BubbleBorder* border = GetBubbleFrameView()->bubble_border(); |
| 187 gfx::Insets bubble_insets = border->GetInsets(); | 185 gfx::Insets bubble_insets = border->GetInsets(); |
| 188 | 186 |
| 189 const int border_size = views::BubbleBorder::is_arrow_on_horizontal(arrow()) | 187 const int border_size = views::BubbleBorder::is_arrow_on_horizontal(arrow()) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 219 |
| 222 bubble_rect.Offset(0, offset); | 220 bubble_rect.Offset(0, offset); |
| 223 border->set_arrow_offset(anchor_rect.CenterPoint().y() - bubble_rect.y()); | 221 border->set_arrow_offset(anchor_rect.CenterPoint().y() - bubble_rect.y()); |
| 224 } | 222 } |
| 225 | 223 |
| 226 GetBubbleFrameView()->SchedulePaint(); | 224 GetBubbleFrameView()->SchedulePaint(); |
| 227 return bubble_rect; | 225 return bubble_rect; |
| 228 } | 226 } |
| 229 | 227 |
| 230 } // namespace ash | 228 } // namespace ash |
| OLD | NEW |