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_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
6 | 6 |
7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); | 157 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); |
158 const gfx::Rect bounds_in_screen = | 158 const gfx::Rect bounds_in_screen = |
159 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds); | 159 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds); |
160 gfx::Rect bounds_in_another_root = | 160 gfx::Rect bounds_in_another_root = |
161 gfx::IntersectRects(root_bounds_in_screen, bounds_in_screen); | 161 gfx::IntersectRects(root_bounds_in_screen, bounds_in_screen); |
162 const float fraction_in_another_window = | 162 const float fraction_in_another_window = |
163 (bounds_in_another_root.width() * bounds_in_another_root.height()) / | 163 (bounds_in_another_root.width() * bounds_in_another_root.height()) / |
164 static_cast<float>(bounds.width() * bounds.height()); | 164 static_cast<float>(bounds.width() * bounds.height()); |
165 | 165 |
166 if (fraction_in_another_window > 0) { | 166 if (fraction_in_another_window > 0) { |
167 if (!drag_window_controller_.get()) { | 167 if (!drag_window_controller_) { |
168 drag_window_controller_.reset( | 168 drag_window_controller_.reset( |
169 new DragWindowController(GetTarget())); | 169 new DragWindowController(GetTarget())); |
170 // Always show the drag phantom on the |another_root| window. | 170 // Always show the drag phantom on the |another_root| window. |
171 drag_window_controller_->SetDestinationDisplay( | 171 drag_window_controller_->SetDestinationDisplay( |
172 Shell::GetScreen()->GetDisplayMatching( | 172 Shell::GetScreen()->GetDisplayMatching( |
173 another_root->GetBoundsInScreen())); | 173 another_root->GetBoundsInScreen())); |
174 drag_window_controller_->Show(); | 174 drag_window_controller_->Show(); |
175 } else { | 175 } else { |
176 // No animation. | 176 // No animation. |
177 drag_window_controller_->SetBounds(bounds_in_screen); | 177 drag_window_controller_->SetBounds(bounds_in_screen); |
(...skipping 12 matching lines...) Expand all Loading... |
190 | 190 |
191 bool DragWindowResizer::ShouldAllowMouseWarp() { | 191 bool DragWindowResizer::ShouldAllowMouseWarp() { |
192 return (details_.window_component == HTCAPTION) && | 192 return (details_.window_component == HTCAPTION) && |
193 !GetTarget()->transient_parent() && | 193 !GetTarget()->transient_parent() && |
194 (GetTarget()->type() == aura::client::WINDOW_TYPE_NORMAL || | 194 (GetTarget()->type() == aura::client::WINDOW_TYPE_NORMAL || |
195 GetTarget()->type() == aura::client::WINDOW_TYPE_PANEL); | 195 GetTarget()->type() == aura::client::WINDOW_TYPE_PANEL); |
196 } | 196 } |
197 | 197 |
198 } // namespace internal | 198 } // namespace internal |
199 } // namespace ash | 199 } // namespace ash |
OLD | NEW |