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/wm/frame_painter.h" | 17 #include "ash/wm/frame_painter.h" |
17 #include "ash/wm/property_util.h" | 18 #include "ash/wm/property_util.h" |
18 #include "ash/wm/window_animations.h" | 19 #include "ash/wm/window_animations.h" |
20 #include "ash/wm/window_properties.h" | |
19 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
20 #include "base/auto_reset.h" | 22 #include "base/auto_reset.h" |
21 #include "base/bind.h" | 23 #include "base/bind.h" |
22 #include "base/bind_helpers.h" | 24 #include "base/bind_helpers.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 25 #include "third_party/skia/include/core/SkColor.h" |
24 #include "third_party/skia/include/core/SkPaint.h" | 26 #include "third_party/skia/include/core/SkPaint.h" |
25 #include "third_party/skia/include/core/SkPath.h" | 27 #include "third_party/skia/include/core/SkPath.h" |
26 #include "ui/aura/client/activation_client.h" | 28 #include "ui/aura/client/activation_client.h" |
27 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
28 #include "ui/aura/focus_manager.h" | 30 #include "ui/aura/focus_manager.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 | 323 |
322 //////////////////////////////////////////////////////////////////////////////// | 324 //////////////////////////////////////////////////////////////////////////////// |
323 // PanelLayoutManager, aura::LayoutManager implementation: | 325 // PanelLayoutManager, aura::LayoutManager implementation: |
324 void PanelLayoutManager::OnWindowResized() { | 326 void PanelLayoutManager::OnWindowResized() { |
325 Relayout(); | 327 Relayout(); |
326 } | 328 } |
327 | 329 |
328 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 330 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
329 if (child->type() == aura::client::WINDOW_TYPE_POPUP) | 331 if (child->type() == aura::client::WINDOW_TYPE_POPUP) |
330 return; | 332 return; |
333 if (!child->GetProperty(kPanelAttachedKey)) { | |
334 // This should only happen when a window is added to panel container as a | |
335 // result of bounds change from within the application during a drag. | |
336 // If so we have already stopped the drag and should reparent the panel | |
337 // back to appropriate container and ignore it. | |
338 // TODO(varkha): Updating bounds during a drag can cause problems and a more | |
339 // general solution is needed. See http://crbug.com/251813 . | |
340 child->SetDefaultParentByRootWindow( | |
flackr
2013/06/21 01:14:48
It makes me uncomfortable that this could cause an
varkha
2013/06/21 01:27:08
Done. Cannot really happen with our current logic
| |
341 child->GetRootWindow(), | |
342 child->GetRootWindow()->GetBoundsInScreen()); | |
343 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer); | |
344 return; | |
345 } | |
331 PanelInfo panel_info; | 346 PanelInfo panel_info; |
332 panel_info.window = child; | 347 panel_info.window = child; |
333 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); | 348 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); |
334 if (child != dragged_panel_) { | 349 if (child != dragged_panel_) { |
335 // Set the panel to 0 opacity until it has been positioned to prevent it | 350 // Set the panel to 0 opacity until it has been positioned to prevent it |
336 // from flashing briefly at position (0, 0). | 351 // from flashing briefly at position (0, 0). |
337 child->layer()->SetOpacity(0); | 352 child->layer()->SetOpacity(0); |
338 panel_info.slide_in = true; | 353 panel_info.slide_in = true; |
339 } | 354 } |
340 panel_windows_.push_back(panel_info); | 355 panel_windows_.push_back(panel_info); |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 | 839 |
825 void PanelLayoutManager::OnKeyboardBoundsChanging( | 840 void PanelLayoutManager::OnKeyboardBoundsChanging( |
826 const gfx::Rect& keyboard_bounds) { | 841 const gfx::Rect& keyboard_bounds) { |
827 // This bounds change will have caused a change to the Shelf which does not | 842 // This bounds change will have caused a change to the Shelf which does not |
828 // propogate automatically to this class, so manually recalculate bounds. | 843 // propogate automatically to this class, so manually recalculate bounds. |
829 OnWindowResized(); | 844 OnWindowResized(); |
830 } | 845 } |
831 | 846 |
832 } // namespace internal | 847 } // namespace internal |
833 } // namespace ash | 848 } // namespace ash |
OLD | NEW |