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

Side by Side Diff: ash/wm/panel_window_resizer.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: formatting and moved a couple unit tests Created 7 years, 10 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/panel_window_resizer.h" 5 #include "ash/wm/panel_window_resizer.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_widget.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
11 #include "ash/wm/cursor_manager.h" 12 #include "ash/wm/cursor_manager.h"
12 #include "ash/wm/panel_layout_manager.h" 13 #include "ash/wm/panel_layout_manager.h"
13 #include "ash/wm/property_util.h" 14 #include "ash/wm/property_util.h"
14 #include "ash/wm/window_properties.h" 15 #include "ash/wm/window_properties.h"
15 #include "ui/aura/client/aura_constants.h" 16 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
17 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (panel_container_) { 96 if (panel_container_) {
96 panel_layout_manager_ = static_cast<internal::PanelLayoutManager*>( 97 panel_layout_manager_ = static_cast<internal::PanelLayoutManager*>(
97 panel_container_->layout_manager()); 98 panel_container_->layout_manager());
98 } 99 }
99 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); 100 ash::Shell::GetInstance()->cursor_manager()->LockCursor();
100 } 101 }
101 102
102 bool PanelWindowResizer::AttachToLauncher(gfx::Rect* bounds) { 103 bool PanelWindowResizer::AttachToLauncher(gfx::Rect* bounds) {
103 bool should_attach = false; 104 bool should_attach = false;
104 if (panel_layout_manager_) { 105 if (panel_layout_manager_) {
105 int launcher_top = panel_layout_manager_->launcher()->widget()-> 106 int launcher_top = panel_layout_manager_->launcher()->
106 GetWindowBoundsInScreen().y(); 107 shelf_widget()->GetWindowBoundsInScreen().y();
107 if (bounds->y() >= (launcher_top - bounds->height() - 108 if (bounds->y() >= (launcher_top - bounds->height() -
108 kPanelSnapToLauncherDistance)) { 109 kPanelSnapToLauncherDistance)) {
109 should_attach = true; 110 should_attach = true;
110 bounds->set_y(launcher_top - bounds->height()); 111 bounds->set_y(launcher_top - bounds->height());
111 } 112 }
112 } 113 }
113 return should_attach; 114 return should_attach;
114 } 115 }
115 116
116 void PanelWindowResizer::StartedDragging() { 117 void PanelWindowResizer::StartedDragging() {
117 if (was_attached_) 118 if (was_attached_)
118 panel_layout_manager_->StartDragging(details_.window); 119 panel_layout_manager_->StartDragging(details_.window);
119 } 120 }
120 121
121 void PanelWindowResizer::FinishDragging() { 122 void PanelWindowResizer::FinishDragging() {
122 if (was_attached_) 123 if (was_attached_)
123 panel_layout_manager_->FinishDragging(); 124 panel_layout_manager_->FinishDragging();
124 } 125 }
125 126
126 } // namespace aura 127 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698