Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: ash/wm/panels/panel_layout_manager.cc

Issue 17431003: Dragging panels near screen edge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dragging panels near screen edge (comments) Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
flackr 2013/06/20 23:00:57 Add TODO to remove this, with a reference to the g
varkha 2013/06/20 23:10:04 Done.
338 child->SetDefaultParentByRootWindow(
339 child->GetRootWindow(),
340 child->GetRootWindow()->GetBoundsInScreen());
341 DCHECK(child->parent()->id() != kShellWindowId_PanelContainer);
342 return;
343 }
331 PanelInfo panel_info; 344 PanelInfo panel_info;
332 panel_info.window = child; 345 panel_info.window = child;
333 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); 346 panel_info.callout_widget = new PanelCalloutWidget(panel_container_);
334 if (child != dragged_panel_) { 347 if (child != dragged_panel_) {
335 // Set the panel to 0 opacity until it has been positioned to prevent it 348 // Set the panel to 0 opacity until it has been positioned to prevent it
336 // from flashing briefly at position (0, 0). 349 // from flashing briefly at position (0, 0).
337 child->layer()->SetOpacity(0); 350 child->layer()->SetOpacity(0);
338 panel_info.slide_in = true; 351 panel_info.slide_in = true;
339 } 352 }
340 panel_windows_.push_back(panel_info); 353 panel_windows_.push_back(panel_info);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 837
825 void PanelLayoutManager::OnKeyboardBoundsChanging( 838 void PanelLayoutManager::OnKeyboardBoundsChanging(
826 const gfx::Rect& keyboard_bounds) { 839 const gfx::Rect& keyboard_bounds) {
827 // This bounds change will have caused a change to the Shelf which does not 840 // This bounds change will have caused a change to the Shelf which does not
828 // propogate automatically to this class, so manually recalculate bounds. 841 // propogate automatically to this class, so manually recalculate bounds.
829 OnWindowResized(); 842 OnWindowResized();
830 } 843 }
831 844
832 } // namespace internal 845 } // namespace internal
833 } // namespace ash 846 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/panels/panel_window_resizer.cc » ('j') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698