Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dock/docked_window_resizer.h" | 5 #include "ash/wm/dock/docked_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 DockedWindowResizer::DockedWindowResizer(WindowResizer* next_window_resizer, | 145 DockedWindowResizer::DockedWindowResizer(WindowResizer* next_window_resizer, |
| 146 const Details& details) | 146 const Details& details) |
| 147 : details_(details), | 147 : details_(details), |
| 148 next_window_resizer_(next_window_resizer), | 148 next_window_resizer_(next_window_resizer), |
| 149 dock_layout_(NULL), | 149 dock_layout_(NULL), |
| 150 initial_dock_layout_(NULL), | 150 initial_dock_layout_(NULL), |
| 151 did_move_or_resize_(false), | 151 did_move_or_resize_(false), |
| 152 was_docked_(false), | 152 was_docked_(false), |
| 153 is_docked_(false), | 153 is_docked_(false), |
| 154 was_bounds_changed_by_user_( | 154 was_bounds_changed_by_user_( |
| 155 wm::GetWindowState(details.window)->bounds_changed_by_user()), | 155 wm::GetWindowState(details.window())->bounds_changed_by_user()), |
|
varkha
2014/01/08 23:46:56
Should GetTarget be used here and below?
| |
| 156 weak_ptr_factory_(this) { | 156 weak_ptr_factory_(this) { |
| 157 DCHECK(details_.is_resizable); | 157 DCHECK(details_.is_resizable); |
| 158 aura::Window* dock_container = Shell::GetContainer( | 158 aura::Window* dock_container = Shell::GetContainer( |
| 159 details.window->GetRootWindow(), | 159 details.window()->GetRootWindow(), |
| 160 kShellWindowId_DockedContainer); | 160 kShellWindowId_DockedContainer); |
| 161 dock_layout_ = static_cast<DockedWindowLayoutManager*>( | 161 dock_layout_ = static_cast<DockedWindowLayoutManager*>( |
| 162 dock_container->layout_manager()); | 162 dock_container->layout_manager()); |
| 163 initial_dock_layout_ = dock_layout_; | 163 initial_dock_layout_ = dock_layout_; |
| 164 was_docked_ = details.window->parent() == dock_container; | 164 was_docked_ = details.window()->parent() == dock_container; |
| 165 is_docked_ = was_docked_; | 165 is_docked_ = was_docked_; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void DockedWindowResizer::MaybeSnapToEdge(const gfx::Rect& bounds, | 168 void DockedWindowResizer::MaybeSnapToEdge(const gfx::Rect& bounds, |
| 169 gfx::Point* offset) { | 169 gfx::Point* offset) { |
| 170 // Windows only snap magnetically when they were previously docked. | 170 // Windows only snap magnetically when they were previously docked. |
| 171 if (!was_docked_) | 171 if (!was_docked_) |
| 172 return; | 172 return; |
| 173 DockedAlignment dock_alignment = dock_layout_->CalculateAlignment(); | 173 DockedAlignment dock_alignment = dock_layout_->CalculateAlignment(); |
| 174 gfx::Rect dock_bounds = ScreenAsh::ConvertRectFromScreen( | 174 gfx::Rect dock_bounds = ScreenAsh::ConvertRectFromScreen( |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 // before. | 327 // before. |
| 328 if (is_docked_) { | 328 if (is_docked_) { |
| 329 wm::GetWindowState(window)->set_bounds_changed_by_user( | 329 wm::GetWindowState(window)->set_bounds_changed_by_user( |
| 330 was_docked_ && (is_resized || was_bounds_changed_by_user_)); | 330 was_docked_ && (is_resized || was_bounds_changed_by_user_)); |
| 331 } | 331 } |
| 332 return action; | 332 return action; |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace internal | 335 } // namespace internal |
| 336 } // namespace ash | 336 } // namespace ash |
| OLD | NEW |