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

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

Issue 24108003: [Cleanup] Rename WindowSettings to WindowState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase fix Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/panels/panel_window_resizer_unittest.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/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
11 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
14 #include "ash/wm/coordinate_conversion.h" 14 #include "ash/wm/coordinate_conversion.h"
15 #include "ash/wm/panels/panel_layout_manager.h" 15 #include "ash/wm/panels/panel_layout_manager.h"
16 #include "ash/wm/property_util.h" 16 #include "ash/wm/window_state.h"
17 #include "ash/wm/window_settings.h"
18 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
19 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/env.h" 19 #include "ui/aura/env.h"
21 #include "ui/aura/root_window.h" 20 #include "ui/aura/root_window.h"
22 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
23 #include "ui/aura/window_delegate.h" 22 #include "ui/aura/window_delegate.h"
24 #include "ui/base/hit_test.h" 23 #include "ui/base/hit_test.h"
25 #include "ui/base/ui_base_types.h" 24 #include "ui/base/ui_base_types.h"
26 #include "ui/gfx/screen.h" 25 #include "ui/gfx/screen.h"
27 #include "ui/views/widget/widget.h" 26 #include "ui/views/widget/widget.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return details_.initial_location_in_parent; 122 return details_.initial_location_in_parent;
124 } 123 }
125 124
126 PanelWindowResizer::PanelWindowResizer(WindowResizer* next_window_resizer, 125 PanelWindowResizer::PanelWindowResizer(WindowResizer* next_window_resizer,
127 const Details& details) 126 const Details& details)
128 : details_(details), 127 : details_(details),
129 next_window_resizer_(next_window_resizer), 128 next_window_resizer_(next_window_resizer),
130 panel_container_(NULL), 129 panel_container_(NULL),
131 initial_panel_container_(NULL), 130 initial_panel_container_(NULL),
132 did_move_or_resize_(false), 131 did_move_or_resize_(false),
133 was_attached_(wm::GetWindowSettings(GetTarget())->panel_attached()), 132 was_attached_(wm::GetWindowState(GetTarget())->panel_attached()),
134 should_attach_(was_attached_), 133 should_attach_(was_attached_),
135 weak_ptr_factory_(this) { 134 weak_ptr_factory_(this) {
136 DCHECK(details_.is_resizable); 135 DCHECK(details_.is_resizable);
137 panel_container_ = Shell::GetContainer( 136 panel_container_ = Shell::GetContainer(
138 details.window->GetRootWindow(), 137 details.window->GetRootWindow(),
139 internal::kShellWindowId_PanelContainer); 138 internal::kShellWindowId_PanelContainer);
140 initial_panel_container_ = panel_container_; 139 initial_panel_container_ = panel_container_;
141 } 140 }
142 141
143 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds, 142 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return should_attach; 183 return should_attach;
185 } 184 }
186 185
187 void PanelWindowResizer::StartedDragging() { 186 void PanelWindowResizer::StartedDragging() {
188 // Tell the panel layout manager that we are dragging this panel before 187 // Tell the panel layout manager that we are dragging this panel before
189 // attaching it so that it does not get repositioned. 188 // attaching it so that it does not get repositioned.
190 if (panel_container_) 189 if (panel_container_)
191 GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget()); 190 GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget());
192 if (!was_attached_) { 191 if (!was_attached_) {
193 // Attach the panel while dragging placing it in front of other panels. 192 // Attach the panel while dragging placing it in front of other panels.
194 wm::GetWindowSettings(GetTarget())->set_continue_drag_after_reparent(true); 193 wm::GetWindowState(GetTarget())->set_continue_drag_after_reparent(true);
195 wm::GetWindowSettings(GetTarget())->set_panel_attached(true); 194 wm::GetWindowState(GetTarget())->set_panel_attached(true);
196 // We use root window coordinates to ensure that during the drag the panel 195 // We use root window coordinates to ensure that during the drag the panel
197 // is reparented to a container in the root window that has that window. 196 // is reparented to a container in the root window that has that window.
198 GetTarget()->SetDefaultParentByRootWindow( 197 GetTarget()->SetDefaultParentByRootWindow(
199 GetTarget()->GetRootWindow(), 198 GetTarget()->GetRootWindow(),
200 GetTarget()->GetRootWindow()->GetBoundsInScreen()); 199 GetTarget()->GetRootWindow()->GetBoundsInScreen());
201 } 200 }
202 } 201 }
203 202
204 void PanelWindowResizer::FinishDragging() { 203 void PanelWindowResizer::FinishDragging() {
205 if (!did_move_or_resize_) 204 if (!did_move_or_resize_)
206 return; 205 return;
207 if (wm::GetWindowSettings(GetTarget())->panel_attached() != should_attach_) { 206 if (wm::GetWindowState(GetTarget())->panel_attached() != should_attach_) {
208 wm::GetWindowSettings(GetTarget())->set_panel_attached(should_attach_); 207 wm::GetWindowState(GetTarget())->set_panel_attached(should_attach_);
209 // We use last known location to ensure that after the drag the panel 208 // We use last known location to ensure that after the drag the panel
210 // is reparented to a container in the root window that has that location. 209 // is reparented to a container in the root window that has that location.
211 GetTarget()->SetDefaultParentByRootWindow( 210 GetTarget()->SetDefaultParentByRootWindow(
212 GetTarget()->GetRootWindow(), 211 GetTarget()->GetRootWindow(),
213 gfx::Rect(last_location_, gfx::Size())); 212 gfx::Rect(last_location_, gfx::Size()));
214 } 213 }
215 214
216 // If we started the drag in one root window and moved into another root 215 // If we started the drag in one root window and moved into another root
217 // but then canceled the drag we may need to inform the original layout 216 // but then canceled the drag we may need to inform the original layout
218 // manager that the drag is finished. 217 // manager that the drag is finished.
219 if (initial_panel_container_ != panel_container_) 218 if (initial_panel_container_ != panel_container_)
220 GetPanelLayoutManager(initial_panel_container_)->FinishDragging(); 219 GetPanelLayoutManager(initial_panel_container_)->FinishDragging();
221 if (panel_container_) 220 if (panel_container_)
222 GetPanelLayoutManager(panel_container_)->FinishDragging(); 221 GetPanelLayoutManager(panel_container_)->FinishDragging();
223 } 222 }
224 223
225 void PanelWindowResizer::UpdateLauncherPosition() { 224 void PanelWindowResizer::UpdateLauncherPosition() {
226 if (panel_container_) { 225 if (panel_container_) {
227 GetPanelLayoutManager(panel_container_)->launcher()-> 226 GetPanelLayoutManager(panel_container_)->launcher()->
228 UpdateIconPositionForWindow(GetTarget()); 227 UpdateIconPositionForWindow(GetTarget());
229 } 228 }
230 } 229 }
231 230
232 } // namespace aura 231 } // namespace aura
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698