| 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/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
| 11 #include "ash/screen_ash.h" | 11 #include "ash/screen_ash.h" |
| 12 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
| 13 #include "ash/shelf/shelf_types.h" | 13 #include "ash/shelf/shelf_types.h" |
| 14 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
| 17 #include "ash/wm/window_animations.h" | 17 #include "ash/wm/window_animations.h" |
| 18 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" |
| 19 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
| 20 #include "base/auto_reset.h" | 20 #include "base/auto_reset.h" |
| 21 #include "base/bind.h" | 21 #include "base/bind.h" |
| 22 #include "base/bind_helpers.h" | 22 #include "base/bind_helpers.h" |
| 23 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
| 24 #include "third_party/skia/include/core/SkPaint.h" | 24 #include "third_party/skia/include/core/SkPaint.h" |
| 25 #include "third_party/skia/include/core/SkPath.h" | 25 #include "third_party/skia/include/core/SkPath.h" |
| 26 #include "ui/aura/client/activation_client.h" | 26 #include "ui/aura/client/activation_client.h" |
| 27 #include "ui/aura/client/focus_client.h" | 27 #include "ui/aura/client/focus_client.h" |
| 28 #include "ui/aura/client/window_tree_client.h" |
| 28 #include "ui/aura/root_window.h" | 29 #include "ui/aura/root_window.h" |
| 29 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
| 30 #include "ui/compositor/scoped_layer_animation_settings.h" | 31 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 31 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
| 32 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
| 33 #include "ui/gfx/vector2d.h" | 34 #include "ui/gfx/vector2d.h" |
| 34 #include "ui/views/background.h" | 35 #include "ui/views/background.h" |
| 35 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 36 | 37 |
| 37 namespace ash { | 38 namespace ash { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 if (in_add_window_) | 348 if (in_add_window_) |
| 348 return; | 349 return; |
| 349 base::AutoReset<bool> auto_reset_in_add_window(&in_add_window_, true); | 350 base::AutoReset<bool> auto_reset_in_add_window(&in_add_window_, true); |
| 350 if (!wm::GetWindowState(child)->panel_attached()) { | 351 if (!wm::GetWindowState(child)->panel_attached()) { |
| 351 // This should only happen when a window is added to panel container as a | 352 // This should only happen when a window is added to panel container as a |
| 352 // result of bounds change from within the application during a drag. | 353 // result of bounds change from within the application during a drag. |
| 353 // If so we have already stopped the drag and should reparent the panel | 354 // If so we have already stopped the drag and should reparent the panel |
| 354 // back to appropriate container and ignore it. | 355 // back to appropriate container and ignore it. |
| 355 // TODO(varkha): Updating bounds during a drag can cause problems and a more | 356 // TODO(varkha): Updating bounds during a drag can cause problems and a more |
| 356 // general solution is needed. See http://crbug.com/251813 . | 357 // general solution is needed. See http://crbug.com/251813 . |
| 357 child->SetDefaultParentByRootWindow( | 358 aura::client::ParentWindowWithContext( |
| 358 child->GetRootWindow(), | 359 child, child, child->GetRootWindow()->GetBoundsInScreen()); |
| 359 child->GetRootWindow()->GetBoundsInScreen()); | |
| 360 wm::ReparentTransientChildrenOfChild(child->parent(), child); | 360 wm::ReparentTransientChildrenOfChild(child->parent(), child); |
| 361 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer); | 361 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer); |
| 362 return; | 362 return; |
| 363 } | 363 } |
| 364 PanelInfo panel_info; | 364 PanelInfo panel_info; |
| 365 panel_info.window = child; | 365 panel_info.window = child; |
| 366 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); | 366 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); |
| 367 if (child != dragged_panel_) { | 367 if (child != dragged_panel_) { |
| 368 // Set the panel to 0 opacity until it has been positioned to prevent it | 368 // Set the panel to 0 opacity until it has been positioned to prevent it |
| 369 // from flashing briefly at position (0, 0). | 369 // from flashing briefly at position (0, 0). |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 | 867 |
| 868 void PanelLayoutManager::OnKeyboardBoundsChanging( | 868 void PanelLayoutManager::OnKeyboardBoundsChanging( |
| 869 const gfx::Rect& keyboard_bounds) { | 869 const gfx::Rect& keyboard_bounds) { |
| 870 // This bounds change will have caused a change to the Shelf which does not | 870 // This bounds change will have caused a change to the Shelf which does not |
| 871 // propogate automatically to this class, so manually recalculate bounds. | 871 // propogate automatically to this class, so manually recalculate bounds. |
| 872 OnWindowResized(); | 872 OnWindowResized(); |
| 873 } | 873 } |
| 874 | 874 |
| 875 } // namespace internal | 875 } // namespace internal |
| 876 } // namespace ash | 876 } // namespace ash |
| OLD | NEW |