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/common/wallpaper/wallpaper_view.h" | 5 #include "ash/common/wallpaper/wallpaper_view.h" |
6 | 6 |
7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
8 #include "ash/common/wallpaper/wallpaper_controller.h" | 8 #include "ash/common/wallpaper/wallpaper_controller.h" |
9 #include "ash/common/wallpaper/wallpaper_delegate.h" | 9 #include "ash/common/wallpaper/wallpaper_delegate.h" |
10 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 10 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
11 #include "ash/common/wm/overview/window_selector_controller.h" | 11 #include "ash/common/wm/overview/window_selector_controller.h" |
12 #include "ash/common/wm_lookup.h" | 12 #include "ash/common/wm_lookup.h" |
13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
15 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
| 16 #include "ui/compositor/layer_type.h" |
16 #include "ui/display/display.h" | 17 #include "ui/display/display.h" |
17 #include "ui/display/manager/managed_display_info.h" | 18 #include "ui/display/manager/managed_display_info.h" |
18 #include "ui/display/screen.h" | 19 #include "ui/display/screen.h" |
19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
20 #include "ui/gfx/geometry/safe_integer_conversions.h" | 21 #include "ui/gfx/geometry/safe_integer_conversions.h" |
21 #include "ui/gfx/geometry/size_conversions.h" | 22 #include "ui/gfx/geometry/size_conversions.h" |
22 #include "ui/gfx/transform.h" | 23 #include "ui/gfx/transform.h" |
23 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
24 | 25 |
25 namespace ash { | 26 namespace ash { |
26 namespace { | 27 namespace { |
27 | 28 |
28 // A view that controls the child view's layer so that the layer always has the | 29 // A view that controls the child view's layer so that the layer always has the |
29 // same size as the display's original, un-scaled size in DIP. The layer is then | 30 // same size as the display's original, un-scaled size in DIP. The layer is then |
30 // transformed to fit to the virtual screen size when laid-out. This is to avoid | 31 // transformed to fit to the virtual screen size when laid-out. This is to avoid |
31 // scaling the image at painting time, then scaling it back to the screen size | 32 // scaling the image at painting time, then scaling it back to the screen size |
32 // in the compositor. | 33 // in the compositor. |
33 class LayerControlView : public views::View { | 34 class LayerControlView : public views::View { |
34 public: | 35 public: |
35 explicit LayerControlView(views::View* view) { | 36 explicit LayerControlView(views::View* view) { |
36 AddChildView(view); | 37 AddChildView(view); |
37 view->SetPaintToLayer(true); | 38 view->SetPaintToLayer(ui::LAYER_TEXTURED); |
38 } | 39 } |
39 | 40 |
40 // Overrides views::View. | 41 // Overrides views::View. |
41 void Layout() override { | 42 void Layout() override { |
42 WmWindow* window = WmLookup::Get()->GetWindowForWidget(GetWidget()); | 43 WmWindow* window = WmLookup::Get()->GetWindowForWidget(GetWidget()); |
43 // Keep |this| at the bottom since there may be other windows on top of the | 44 // Keep |this| at the bottom since there may be other windows on top of the |
44 // wallpaper view such as an overview mode shield. | 45 // wallpaper view such as an overview mode shield. |
45 window->GetParent()->StackChildAtBottom(window); | 46 window->GetParent()->StackChildAtBottom(window); |
46 display::Display display = window->GetDisplayNearestWindow(); | 47 display::Display display = window->GetDisplayNearestWindow(); |
47 | 48 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Disable animation if transition to login screen from an empty background. | 232 // Disable animation if transition to login screen from an empty background. |
232 wallpaper_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); | 233 wallpaper_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); |
233 } | 234 } |
234 | 235 |
235 WmWindow* container = root_window->GetChildByShellWindowId(container_id); | 236 WmWindow* container = root_window->GetChildByShellWindowId(container_id); |
236 wallpaper_widget->SetBounds(container->GetBounds()); | 237 wallpaper_widget->SetBounds(container->GetBounds()); |
237 return wallpaper_widget; | 238 return wallpaper_widget; |
238 } | 239 } |
239 | 240 |
240 } // namespace ash | 241 } // namespace ash |
OLD | NEW |