| 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/desktop_background/desktop_background_view.h" | 5 #include "ash/desktop_background/desktop_background_view.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/display/display_info.h" | 8 #include "ash/common/display/display_info.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 10 #include "ash/common/wm/overview/window_selector_controller.h" | 11 #include "ash/common/wm/overview/window_selector_controller.h" |
| 11 #include "ash/common/wm_lookup.h" | 12 #include "ash/common/wm_lookup.h" |
| 12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 13 #include "ash/desktop_background/desktop_background_controller.h" | 14 #include "ash/desktop_background/desktop_background_controller.h" |
| 14 #include "ash/desktop_background/desktop_background_widget_controller.h" | 15 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| 15 #include "ash/desktop_background/user_wallpaper_delegate.h" | |
| 16 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ui/display/display.h" | 18 #include "ui/display/display.h" |
| 19 #include "ui/display/screen.h" | 19 #include "ui/display/screen.h" |
| 20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 21 #include "ui/gfx/geometry/safe_integer_conversions.h" | 21 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 22 #include "ui/gfx/geometry/size_conversions.h" | 22 #include "ui/gfx/geometry/size_conversions.h" |
| 23 #include "ui/gfx/transform.h" | 23 #include "ui/gfx/transform.h" |
| 24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 25 | 25 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const gfx::Point& point, | 184 const gfx::Point& point, |
| 185 ui::MenuSourceType source_type) { | 185 ui::MenuSourceType source_type) { |
| 186 WmShell::Get()->ShowContextMenu(point, source_type); | 186 WmShell::Get()->ShowContextMenu(point, source_type); |
| 187 } | 187 } |
| 188 | 188 |
| 189 views::Widget* CreateDesktopBackground(WmWindow* root_window, | 189 views::Widget* CreateDesktopBackground(WmWindow* root_window, |
| 190 int container_id) { | 190 int container_id) { |
| 191 aura::Window* aura_root_window = WmWindowAura::GetAuraWindow(root_window); | 191 aura::Window* aura_root_window = WmWindowAura::GetAuraWindow(root_window); |
| 192 DesktopBackgroundController* controller = | 192 DesktopBackgroundController* controller = |
| 193 Shell::GetInstance()->desktop_background_controller(); | 193 Shell::GetInstance()->desktop_background_controller(); |
| 194 UserWallpaperDelegate* wallpaper_delegate = | 194 WallpaperDelegate* wallpaper_delegate = WmShell::Get()->wallpaper_delegate(); |
| 195 Shell::GetInstance()->user_wallpaper_delegate(); | |
| 196 | 195 |
| 197 views::Widget* desktop_widget = new views::Widget; | 196 views::Widget* desktop_widget = new views::Widget; |
| 198 views::Widget::InitParams params( | 197 views::Widget::InitParams params( |
| 199 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 198 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 200 params.name = "DesktopBackgroundView"; | 199 params.name = "DesktopBackgroundView"; |
| 201 if (controller->GetWallpaper().isNull()) | 200 if (controller->GetWallpaper().isNull()) |
| 202 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 201 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 203 params.parent = aura_root_window->GetChildById(container_id); | 202 params.parent = aura_root_window->GetChildById(container_id); |
| 204 desktop_widget->Init(params); | 203 desktop_widget->Init(params); |
| 205 desktop_widget->SetContentsView( | 204 desktop_widget->SetContentsView( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 229 } else { | 228 } else { |
| 230 // Disable animation if transition to login screen from an empty background. | 229 // Disable animation if transition to login screen from an empty background. |
| 231 desktop_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); | 230 desktop_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); |
| 232 } | 231 } |
| 233 | 232 |
| 234 desktop_widget->SetBounds(params.parent->bounds()); | 233 desktop_widget->SetBounds(params.parent->bounds()); |
| 235 return desktop_widget; | 234 return desktop_widget; |
| 236 } | 235 } |
| 237 | 236 |
| 238 } // namespace ash | 237 } // namespace ash |
| OLD | NEW |