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

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

Issue 1929023002: Refactors WindowResizers to use ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move forward declaration Created 4 years, 7 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
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/workspace/phantom_window_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_window_resizer.h" 5 #include "ash/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/shelf/shelf.h" 7 #include "ash/wm/common/shelf/wm_shelf.h"
8 #include "ash/shelf/shelf_types.h"
9 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/aura/wm_window_aura.h"
12 #include "ash/wm/common/window_parenting_utils.h" 8 #include "ash/wm/common/window_parenting_utils.h"
13 #include "ash/wm/common/window_state.h" 9 #include "ash/wm/common/window_state.h"
14 #include "ash/wm/common/wm_root_window_controller.h" 10 #include "ash/wm/common/wm_root_window_controller.h"
11 #include "ash/wm/common/wm_shell_window_ids.h"
15 #include "ash/wm/common/wm_window.h" 12 #include "ash/wm/common/wm_window.h"
16 #include "ash/wm/panels/panel_layout_manager.h" 13 #include "ash/wm/panels/panel_layout_manager.h"
17 #include "ui/base/hit_test.h" 14 #include "ui/base/hit_test.h"
18 #include "ui/base/ui_base_types.h" 15 #include "ui/base/ui_base_types.h"
19 #include "ui/display/screen.h" 16 #include "ui/display/screen.h"
20 #include "ui/views/widget/widget.h"
21 17
22 namespace ash { 18 namespace ash {
23 19
24 namespace { 20 namespace {
25 21
26 const int kPanelSnapToLauncherDistance = 30; 22 const int kPanelSnapToLauncherDistance = 30;
27 23
28 } // namespace 24 } // namespace
29 25
30 PanelWindowResizer::~PanelWindowResizer() { 26 PanelWindowResizer::~PanelWindowResizer() {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 initial_panel_container_ = panel_container_; 111 initial_panel_container_ = panel_container_;
116 } 112 }
117 113
118 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds, 114 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds,
119 gfx::Point* offset) { 115 gfx::Point* offset) {
120 bool should_attach = false; 116 bool should_attach = false;
121 if (panel_container_) { 117 if (panel_container_) {
122 PanelLayoutManager* panel_layout_manager = 118 PanelLayoutManager* panel_layout_manager =
123 PanelLayoutManager::Get(panel_container_); 119 PanelLayoutManager::Get(panel_container_);
124 gfx::Rect launcher_bounds = GetTarget()->GetParent()->ConvertRectFromScreen( 120 gfx::Rect launcher_bounds = GetTarget()->GetParent()->ConvertRectFromScreen(
125 panel_layout_manager->shelf() 121 panel_layout_manager->shelf()->GetWindow()->GetBoundsInScreen());
126 ->shelf_widget() 122 switch (panel_layout_manager->shelf()->GetAlignment()) {
127 ->GetWindowBoundsInScreen());
128 switch (panel_layout_manager->shelf()->alignment()) {
129 case wm::SHELF_ALIGNMENT_BOTTOM: 123 case wm::SHELF_ALIGNMENT_BOTTOM:
130 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: 124 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED:
131 if (bounds.bottom() >= (launcher_bounds.y() - 125 if (bounds.bottom() >= (launcher_bounds.y() -
132 kPanelSnapToLauncherDistance)) { 126 kPanelSnapToLauncherDistance)) {
133 should_attach = true; 127 should_attach = true;
134 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y()); 128 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y());
135 } 129 }
136 break; 130 break;
137 case wm::SHELF_ALIGNMENT_LEFT: 131 case wm::SHELF_ALIGNMENT_LEFT:
138 if (bounds.x() <= (launcher_bounds.right() + 132 if (bounds.x() <= (launcher_bounds.right() +
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (initial_panel_container_ != panel_container_) 189 if (initial_panel_container_ != panel_container_)
196 PanelLayoutManager::Get(initial_panel_container_)->FinishDragging(); 190 PanelLayoutManager::Get(initial_panel_container_)->FinishDragging();
197 if (panel_container_) 191 if (panel_container_)
198 PanelLayoutManager::Get(panel_container_)->FinishDragging(); 192 PanelLayoutManager::Get(panel_container_)->FinishDragging();
199 } 193 }
200 194
201 void PanelWindowResizer::UpdateLauncherPosition() { 195 void PanelWindowResizer::UpdateLauncherPosition() {
202 if (panel_container_) { 196 if (panel_container_) {
203 PanelLayoutManager::Get(panel_container_) 197 PanelLayoutManager::Get(panel_container_)
204 ->shelf() 198 ->shelf()
205 ->UpdateIconPositionForWindow( 199 ->UpdateIconPositionForWindow(GetTarget());
206 wm::WmWindowAura::GetAuraWindow(GetTarget()));
207 } 200 }
208 } 201 }
209 202
210 } // namespace ash 203 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/workspace/phantom_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698