| 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/wm/drag_window_controller.h" | 5 #include "ash/wm/drag_window_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 26 #include "ui/wm/core/shadow_types.h" | 26 #include "ui/wm/core/shadow_types.h" |
| 27 #include "ui/wm/core/window_util.h" | 27 #include "ui/wm/core/window_util.h" |
| 28 | 28 |
| 29 namespace ash { | 29 namespace ash { |
| 30 | 30 |
| 31 // This keeps tack of the drag window's state. It creates/destory/updates bounds | 31 // This keeps tack of the drag window's state. It creates/destory/updates bounds |
| 32 // and opacity based on the current bounds. | 32 // and opacity based on the current bounds. |
| 33 class DragWindowController::DragWindowDetails : public aura::WindowDelegate { | 33 class DragWindowController::DragWindowDetails : public aura::WindowDelegate { |
| 34 public: | 34 public: |
| 35 DragWindowDetails(const gfx::Display& display, aura::Window* original_window) | 35 DragWindowDetails(const display::Display& display, |
| 36 aura::Window* original_window) |
| 36 : root_window_(Shell::GetInstance() | 37 : root_window_(Shell::GetInstance() |
| 37 ->window_tree_host_manager() | 38 ->window_tree_host_manager() |
| 38 ->GetRootWindowForDisplayId(display.id())) {} | 39 ->GetRootWindowForDisplayId(display.id())) {} |
| 39 | 40 |
| 40 ~DragWindowDetails() override { | 41 ~DragWindowDetails() override { |
| 41 delete drag_window_; | 42 delete drag_window_; |
| 42 DCHECK(!drag_window_); | 43 DCHECK(!drag_window_); |
| 43 } | 44 } |
| 44 | 45 |
| 45 void Update(aura::Window* original_window, | 46 void Update(aura::Window* original_window, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // The maximum opacity of the drag phantom window. | 176 // The maximum opacity of the drag phantom window. |
| 176 static const float kMaxOpacity = 0.8f; | 177 static const float kMaxOpacity = 0.8f; |
| 177 | 178 |
| 178 return kMaxOpacity * visible_bounds.size().GetArea() / | 179 return kMaxOpacity * visible_bounds.size().GetArea() / |
| 179 window_bounds.size().GetArea(); | 180 window_bounds.size().GetArea(); |
| 180 } | 181 } |
| 181 | 182 |
| 182 DragWindowController::DragWindowController(aura::Window* window) | 183 DragWindowController::DragWindowController(aura::Window* window) |
| 183 : window_(window) { | 184 : window_(window) { |
| 184 DCHECK(drag_windows_.empty()); | 185 DCHECK(drag_windows_.empty()); |
| 185 gfx::Screen* screen = gfx::Screen::GetScreen(); | 186 display::Screen* screen = display::Screen::GetScreen(); |
| 186 gfx::Display current = screen->GetDisplayNearestWindow(window_); | 187 display::Display current = screen->GetDisplayNearestWindow(window_); |
| 187 | 188 |
| 188 for (const gfx::Display& display : screen->GetAllDisplays()) { | 189 for (const display::Display& display : screen->GetAllDisplays()) { |
| 189 if (current.id() == display.id()) | 190 if (current.id() == display.id()) |
| 190 continue; | 191 continue; |
| 191 drag_windows_.push_back( | 192 drag_windows_.push_back( |
| 192 base::WrapUnique(new DragWindowDetails(display, window_))); | 193 base::WrapUnique(new DragWindowDetails(display, window_))); |
| 193 } | 194 } |
| 194 } | 195 } |
| 195 | 196 |
| 196 DragWindowController::~DragWindowController() {} | 197 DragWindowController::~DragWindowController() {} |
| 197 | 198 |
| 198 void DragWindowController::Update(const gfx::Rect& bounds_in_screen, | 199 void DragWindowController::Update(const gfx::Rect& bounds_in_screen, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 228 if (details->layer_owner_) { | 229 if (details->layer_owner_) { |
| 229 if (index == 0) | 230 if (index == 0) |
| 230 return details->layer_owner_.get(); | 231 return details->layer_owner_.get(); |
| 231 index--; | 232 index--; |
| 232 } | 233 } |
| 233 } | 234 } |
| 234 return nullptr; | 235 return nullptr; |
| 235 } | 236 } |
| 236 | 237 |
| 237 } // namespace ash | 238 } // namespace ash |
| OLD | NEW |