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/shelf/overflow_bubble_view.h" | 5 #include "ash/shelf/overflow_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
12 #include "ash/shelf/shelf_constants.h" | 12 #include "ash/shelf/shelf_constants.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/wm_window.h" | |
15 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
16 #include "ui/display/display.h" | 15 #include "ui/display/display.h" |
17 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
18 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
19 #include "ui/gfx/geometry/insets.h" | 18 #include "ui/gfx/geometry/insets.h" |
20 #include "ui/views/bubble/bubble_frame_view.h" | 19 #include "ui/views/bubble/bubble_frame_view.h" |
21 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
22 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
23 | 22 |
24 namespace ash { | 23 namespace ash { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } | 155 } |
157 | 156 |
158 int OverflowBubbleView::GetDialogButtons() const { | 157 int OverflowBubbleView::GetDialogButtons() const { |
159 return ui::DIALOG_BUTTON_NONE; | 158 return ui::DIALOG_BUTTON_NONE; |
160 } | 159 } |
161 | 160 |
162 void OverflowBubbleView::OnBeforeBubbleWidgetInit( | 161 void OverflowBubbleView::OnBeforeBubbleWidgetInit( |
163 views::Widget::InitParams* params, | 162 views::Widget::InitParams* params, |
164 views::Widget* bubble_widget) const { | 163 views::Widget* bubble_widget) const { |
165 // Place the bubble in the same root window as the anchor. | 164 // Place the bubble in the same root window as the anchor. |
166 WmWindow::Get(anchor_widget()->GetNativeWindow()) | 165 RootWindowController::ForWindow(anchor_widget()->GetNativeWindow()) |
167 ->GetRootWindowController() | |
168 ->ConfigureWidgetInitParamsForContainer( | 166 ->ConfigureWidgetInitParamsForContainer( |
169 bubble_widget, kShellWindowId_ShelfBubbleContainer, params); | 167 bubble_widget, kShellWindowId_ShelfBubbleContainer, params); |
170 } | 168 } |
171 | 169 |
172 gfx::Rect OverflowBubbleView::GetBubbleBounds() { | 170 gfx::Rect OverflowBubbleView::GetBubbleBounds() { |
173 const gfx::Size content_size = GetPreferredSize(); | 171 const gfx::Size content_size = GetPreferredSize(); |
174 const gfx::Rect anchor_rect = GetAnchorRect(); | 172 const gfx::Rect anchor_rect = GetAnchorRect(); |
175 gfx::Rect monitor_rect = | 173 gfx::Rect monitor_rect = |
176 display::Screen::GetScreen() | 174 display::Screen::GetScreen() |
177 ->GetDisplayNearestPoint(anchor_rect.CenterPoint()) | 175 ->GetDisplayNearestPoint(anchor_rect.CenterPoint()) |
(...skipping 24 matching lines...) Expand all Loading... |
202 else if (bounds.bottom() > monitor_rect.bottom()) | 200 else if (bounds.bottom() > monitor_rect.bottom()) |
203 bounds.Offset(monitor_rect.bottom() - bounds.bottom(), 0); | 201 bounds.Offset(monitor_rect.bottom() - bounds.bottom(), 0); |
204 return bounds; | 202 return bounds; |
205 } | 203 } |
206 | 204 |
207 void OverflowBubbleView::UpdateShelfBackground(SkColor color) { | 205 void OverflowBubbleView::UpdateShelfBackground(SkColor color) { |
208 set_color(color); | 206 set_color(color); |
209 } | 207 } |
210 | 208 |
211 } // namespace ash | 209 } // namespace ash |
OLD | NEW |