| 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 "ash/wallpaper/wallpaper_view.h" | 5 #include "ash/wallpaper/wallpaper_view.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/session/session_controller.h" | 8 #include "ash/session/session_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" |
| 10 #include "ash/wallpaper/wallpaper_controller.h" | 11 #include "ash/wallpaper/wallpaper_controller.h" |
| 11 #include "ash/wallpaper/wallpaper_delegate.h" | 12 #include "ash/wallpaper/wallpaper_delegate.h" |
| 12 #include "ash/wallpaper/wallpaper_widget_controller.h" | 13 #include "ash/wallpaper/wallpaper_widget_controller.h" |
| 13 #include "ash/wm/overview/window_selector_controller.h" | 14 #include "ash/wm/overview/window_selector_controller.h" |
| 14 #include "ash/wm_shell.h" | |
| 15 #include "ash/wm_window.h" | 15 #include "ash/wm_window.h" |
| 16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
| 17 #include "ui/display/manager/managed_display_info.h" | 17 #include "ui/display/manager/managed_display_info.h" |
| 18 #include "ui/display/screen.h" | 18 #include "ui/display/screen.h" |
| 19 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/geometry/safe_integer_conversions.h" | 20 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 21 #include "ui/gfx/geometry/size_conversions.h" | 21 #include "ui/gfx/geometry/size_conversions.h" |
| 22 #include "ui/gfx/transform.h" | 22 #include "ui/gfx/transform.h" |
| 23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 24 | 24 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 void Layout() override { | 41 void Layout() override { |
| 42 WmWindow* window = WmWindow::Get(GetWidget()->GetNativeWindow()); | 42 WmWindow* window = WmWindow::Get(GetWidget()->GetNativeWindow()); |
| 43 // Keep |this| at the bottom since there may be other windows on top of the | 43 // Keep |this| at the bottom since there may be other windows on top of the |
| 44 // wallpaper view such as an overview mode shield. | 44 // wallpaper view such as an overview mode shield. |
| 45 window->GetParent()->StackChildAtBottom(window); | 45 window->GetParent()->StackChildAtBottom(window); |
| 46 display::Display display = window->GetDisplayNearestWindow(); | 46 display::Display display = window->GetDisplayNearestWindow(); |
| 47 | 47 |
| 48 // TODO(mash): Mash returns a fake ManagedDisplayInfo. crbug.com/622480 | 48 // TODO(mash): Mash returns a fake ManagedDisplayInfo. crbug.com/622480 |
| 49 float ui_scale = 1.f; | 49 float ui_scale = 1.f; |
| 50 display::ManagedDisplayInfo info = | 50 display::ManagedDisplayInfo info = |
| 51 WmShell::Get()->GetDisplayInfo(display.id()); | 51 ShellPort::Get()->GetDisplayInfo(display.id()); |
| 52 if (info.id() == display.id()) | 52 if (info.id() == display.id()) |
| 53 ui_scale = info.GetEffectiveUIScale(); | 53 ui_scale = info.GetEffectiveUIScale(); |
| 54 | 54 |
| 55 gfx::Size rounded_size = | 55 gfx::Size rounded_size = |
| 56 gfx::ScaleToFlooredSize(display.size(), 1.f / ui_scale); | 56 gfx::ScaleToFlooredSize(display.size(), 1.f / ui_scale); |
| 57 DCHECK_EQ(1, child_count()); | 57 DCHECK_EQ(1, child_count()); |
| 58 views::View* child = child_at(0); | 58 views::View* child = child_at(0); |
| 59 child->SetBounds(0, 0, rounded_size.width(), rounded_size.height()); | 59 child->SetBounds(0, 0, rounded_size.width(), rounded_size.height()); |
| 60 gfx::Transform transform; | 60 gfx::Transform transform; |
| 61 // Apply RTL transform explicitly becacuse Views layer code | 61 // Apply RTL transform explicitly becacuse Views layer code |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool WallpaperView::OnMousePressed(const ui::MouseEvent& event) { | 184 bool WallpaperView::OnMousePressed(const ui::MouseEvent& event) { |
| 185 return true; | 185 return true; |
| 186 } | 186 } |
| 187 | 187 |
| 188 void WallpaperView::ShowContextMenuForView(views::View* source, | 188 void WallpaperView::ShowContextMenuForView(views::View* source, |
| 189 const gfx::Point& point, | 189 const gfx::Point& point, |
| 190 ui::MenuSourceType source_type) { | 190 ui::MenuSourceType source_type) { |
| 191 WmShell::Get()->ShowContextMenu(point, source_type); | 191 ShellPort::Get()->ShowContextMenu(point, source_type); |
| 192 } | 192 } |
| 193 | 193 |
| 194 views::Widget* CreateWallpaper(WmWindow* root_window, int container_id) { | 194 views::Widget* CreateWallpaper(WmWindow* root_window, int container_id) { |
| 195 WallpaperController* controller = Shell::Get()->wallpaper_controller(); | 195 WallpaperController* controller = Shell::Get()->wallpaper_controller(); |
| 196 WallpaperDelegate* wallpaper_delegate = Shell::Get()->wallpaper_delegate(); | 196 WallpaperDelegate* wallpaper_delegate = Shell::Get()->wallpaper_delegate(); |
| 197 | 197 |
| 198 views::Widget* wallpaper_widget = new views::Widget; | 198 views::Widget* wallpaper_widget = new views::Widget; |
| 199 views::Widget::InitParams params( | 199 views::Widget::InitParams params( |
| 200 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 200 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 201 params.name = "WallpaperView"; | 201 params.name = "WallpaperView"; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 231 // Disable animation if transition to login screen from an empty background. | 231 // Disable animation if transition to login screen from an empty background. |
| 232 wallpaper_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); | 232 wallpaper_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); |
| 233 } | 233 } |
| 234 | 234 |
| 235 WmWindow* container = root_window->GetChildByShellWindowId(container_id); | 235 WmWindow* container = root_window->GetChildByShellWindowId(container_id); |
| 236 wallpaper_widget->SetBounds(container->GetBounds()); | 236 wallpaper_widget->SetBounds(container->GetBounds()); |
| 237 return wallpaper_widget; | 237 return wallpaper_widget; |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace ash | 240 } // namespace ash |
| OLD | NEW |