| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // This is to avoid scaling the image at painting time, then scaling | 42 // This is to avoid scaling the image at painting time, then scaling |
| 43 // it back to the screen size in the compositor. | 43 // it back to the screen size in the compositor. |
| 44 class LayerControlView : public views::View { | 44 class LayerControlView : public views::View { |
| 45 public: | 45 public: |
| 46 explicit LayerControlView(views::View* view) { | 46 explicit LayerControlView(views::View* view) { |
| 47 AddChildView(view); | 47 AddChildView(view); |
| 48 view->SetPaintToLayer(true); | 48 view->SetPaintToLayer(true); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Overrides views::View. | 51 // Overrides views::View. |
| 52 virtual void Layout() OVERRIDE { | 52 virtual void Layout() override { |
| 53 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( | 53 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( |
| 54 GetWidget()->GetNativeView()); | 54 GetWidget()->GetNativeView()); |
| 55 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 55 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 56 DisplayInfo info = display_manager->GetDisplayInfo(display.id()); | 56 DisplayInfo info = display_manager->GetDisplayInfo(display.id()); |
| 57 float ui_scale = info.GetEffectiveUIScale(); | 57 float ui_scale = info.GetEffectiveUIScale(); |
| 58 gfx::SizeF pixel_size = display.size(); | 58 gfx::SizeF pixel_size = display.size(); |
| 59 pixel_size.Scale(1.0f / ui_scale); | 59 pixel_size.Scale(1.0f / ui_scale); |
| 60 gfx::Size rounded_size = gfx::ToCeiledSize(pixel_size); | 60 gfx::Size rounded_size = gfx::ToCeiledSize(pixel_size); |
| 61 DCHECK_EQ(1, child_count()); | 61 DCHECK_EQ(1, child_count()); |
| 62 views::View* child = child_at(0); | 62 views::View* child = child_at(0); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 76 // the following: | 76 // the following: |
| 77 // - Disabling overview mode on touch release. | 77 // - Disabling overview mode on touch release. |
| 78 // - Disabling overview mode on mouse release. | 78 // - Disabling overview mode on mouse release. |
| 79 class PreEventDispatchHandler : public ui::EventHandler { | 79 class PreEventDispatchHandler : public ui::EventHandler { |
| 80 public: | 80 public: |
| 81 PreEventDispatchHandler() {} | 81 PreEventDispatchHandler() {} |
| 82 virtual ~PreEventDispatchHandler() {} | 82 virtual ~PreEventDispatchHandler() {} |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 // ui::EventHandler: | 85 // ui::EventHandler: |
| 86 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 86 virtual void OnMouseEvent(ui::MouseEvent* event) override { |
| 87 CHECK_EQ(ui::EP_PRETARGET, event->phase()); | 87 CHECK_EQ(ui::EP_PRETARGET, event->phase()); |
| 88 WindowSelectorController* controller = | 88 WindowSelectorController* controller = |
| 89 Shell::GetInstance()->window_selector_controller(); | 89 Shell::GetInstance()->window_selector_controller(); |
| 90 if (event->type() == ui::ET_MOUSE_RELEASED && controller->IsSelecting()) { | 90 if (event->type() == ui::ET_MOUSE_RELEASED && controller->IsSelecting()) { |
| 91 controller->ToggleOverview(); | 91 controller->ToggleOverview(); |
| 92 event->StopPropagation(); | 92 event->StopPropagation(); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { | 96 virtual void OnGestureEvent(ui::GestureEvent* event) override { |
| 97 CHECK_EQ(ui::EP_PRETARGET, event->phase()); | 97 CHECK_EQ(ui::EP_PRETARGET, event->phase()); |
| 98 WindowSelectorController* controller = | 98 WindowSelectorController* controller = |
| 99 Shell::GetInstance()->window_selector_controller(); | 99 Shell::GetInstance()->window_selector_controller(); |
| 100 if (event->type() == ui::ET_GESTURE_TAP && controller->IsSelecting()) { | 100 if (event->type() == ui::ET_GESTURE_TAP && controller->IsSelecting()) { |
| 101 controller->ToggleOverview(); | 101 controller->ToggleOverview(); |
| 102 event->StopPropagation(); | 102 event->StopPropagation(); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(PreEventDispatchHandler); | 106 DISALLOW_COPY_AND_ASSIGN(PreEventDispatchHandler); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // Disable animation if transition to login screen from an empty background. | 254 // Disable animation if transition to login screen from an empty background. |
| 255 wm::SetWindowVisibilityAnimationTransition( | 255 wm::SetWindowVisibilityAnimationTransition( |
| 256 desktop_widget->GetNativeView(), wm::ANIMATE_NONE); | 256 desktop_widget->GetNativeView(), wm::ANIMATE_NONE); |
| 257 } | 257 } |
| 258 | 258 |
| 259 desktop_widget->SetBounds(params.parent->bounds()); | 259 desktop_widget->SetBounds(params.parent->bounds()); |
| 260 return desktop_widget; | 260 return desktop_widget; |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace ash | 263 } // namespace ash |
| OLD | NEW |