Chromium Code Reviews| 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/wm/frame_painter.h" | 16 #include "ash/wm/frame_painter.h" |
| 17 #include "ash/wm/property_util.h" | 17 #include "ash/wm/property_util.h" |
| 18 #include "ash/wm/window_animations.h" | 18 #include "ash/wm/window_animations.h" |
| 19 #include "ash/wm/window_properties.h" | |
| 19 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
| 20 #include "base/auto_reset.h" | 21 #include "base/auto_reset.h" |
| 21 #include "base/bind.h" | 22 #include "base/bind.h" |
| 22 #include "base/bind_helpers.h" | 23 #include "base/bind_helpers.h" |
| 23 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
| 24 #include "third_party/skia/include/core/SkPaint.h" | 25 #include "third_party/skia/include/core/SkPaint.h" |
| 25 #include "third_party/skia/include/core/SkPath.h" | 26 #include "third_party/skia/include/core/SkPath.h" |
| 26 #include "ui/aura/client/activation_client.h" | 27 #include "ui/aura/client/activation_client.h" |
| 27 #include "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
| 28 #include "ui/aura/focus_manager.h" | 29 #include "ui/aura/focus_manager.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 } | 321 } |
| 321 | 322 |
| 322 //////////////////////////////////////////////////////////////////////////////// | 323 //////////////////////////////////////////////////////////////////////////////// |
| 323 // PanelLayoutManager, aura::LayoutManager implementation: | 324 // PanelLayoutManager, aura::LayoutManager implementation: |
| 324 void PanelLayoutManager::OnWindowResized() { | 325 void PanelLayoutManager::OnWindowResized() { |
| 325 Relayout(); | 326 Relayout(); |
| 326 } | 327 } |
| 327 | 328 |
| 328 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 329 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
| 329 if (child->type() == aura::client::WINDOW_TYPE_POPUP) | 330 if (child->type() == aura::client::WINDOW_TYPE_POPUP) |
| 330 return; | 331 return; |
|
flackr
2013/06/20 02:18:56
If there's not an easy way to avoid the panel bein
| |
| 331 PanelInfo panel_info; | 332 PanelInfo panel_info; |
| 332 panel_info.window = child; | 333 panel_info.window = child; |
| 333 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); | 334 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); |
| 334 if (child != dragged_panel_) { | 335 if (child != dragged_panel_) { |
| 335 // Set the panel to 0 opacity until it has been positioned to prevent it | 336 // Set the panel to 0 opacity until it has been positioned to prevent it |
| 336 // from flashing briefly at position (0, 0). | 337 // from flashing briefly at position (0, 0). |
| 337 child->layer()->SetOpacity(0); | 338 child->layer()->SetOpacity(0); |
| 338 panel_info.slide_in = true; | 339 panel_info.slide_in = true; |
| 339 } | 340 } |
| 340 panel_windows_.push_back(panel_info); | 341 panel_windows_.push_back(panel_info); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 on_launcher = true; | 658 on_launcher = true; |
| 658 } | 659 } |
| 659 | 660 |
| 660 if (on_launcher) { | 661 if (on_launcher) { |
| 661 ui::ScopedLayerAnimationSettings panel_slide_settings( | 662 ui::ScopedLayerAnimationSettings panel_slide_settings( |
| 662 layer->GetAnimator()); | 663 layer->GetAnimator()); |
| 663 panel_slide_settings.SetPreemptionStrategy( | 664 panel_slide_settings.SetPreemptionStrategy( |
| 664 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 665 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 665 panel_slide_settings.SetTransitionDuration( | 666 panel_slide_settings.SetTransitionDuration( |
| 666 base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds)); | 667 base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds)); |
| 668 visible_panels[i].window->SetProperty(internal::kPanelAttachedKey, true); | |
| 667 SetChildBoundsDirect(visible_panels[i].window, bounds); | 669 SetChildBoundsDirect(visible_panels[i].window, bounds); |
| 668 if (slide_in) | 670 if (slide_in) |
| 669 layer->SetOpacity(1); | 671 layer->SetOpacity(1); |
| 670 } else { | 672 } else { |
| 671 // If the launcher moved don't animate, move immediately to the new | 673 // If the launcher moved don't animate, move immediately to the new |
| 672 // target location. | 674 // target location. |
| 673 SetChildBoundsDirect(visible_panels[i].window, bounds); | 675 SetChildBoundsDirect(visible_panels[i].window, bounds); |
| 674 } | 676 } |
| 675 } | 677 } |
| 676 | 678 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 824 | 826 |
| 825 void PanelLayoutManager::OnKeyboardBoundsChanging( | 827 void PanelLayoutManager::OnKeyboardBoundsChanging( |
| 826 const gfx::Rect& keyboard_bounds) { | 828 const gfx::Rect& keyboard_bounds) { |
| 827 // This bounds change will have caused a change to the Shelf which does not | 829 // This bounds change will have caused a change to the Shelf which does not |
| 828 // propogate automatically to this class, so manually recalculate bounds. | 830 // propogate automatically to this class, so manually recalculate bounds. |
| 829 OnWindowResized(); | 831 OnWindowResized(); |
| 830 } | 832 } |
| 831 | 833 |
| 832 } // namespace internal | 834 } // namespace internal |
| 833 } // namespace ash | 835 } // namespace ash |
| OLD | NEW |