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

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

Issue 12441010: Attach panel while dragging to bring it in front of other panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments, etc. Created 7 years, 9 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
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"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 delete iter->callout_widget; 231 delete iter->callout_widget;
232 } 232 }
233 panel_windows_.clear(); 233 panel_windows_.clear();
234 if (launcher_) 234 if (launcher_)
235 launcher_->RemoveIconObserver(this); 235 launcher_->RemoveIconObserver(this);
236 launcher_ = NULL; 236 launcher_ = NULL;
237 } 237 }
238 238
239 void PanelLayoutManager::StartDragging(aura::Window* panel) { 239 void PanelLayoutManager::StartDragging(aura::Window* panel) {
240 DCHECK(!dragged_panel_); 240 DCHECK(!dragged_panel_);
241 DCHECK(panel->parent() == panel_container_);
242 dragged_panel_ = panel; 241 dragged_panel_ = panel;
243 Relayout(); 242 Relayout();
244 } 243 }
245 244
246 void PanelLayoutManager::FinishDragging() { 245 void PanelLayoutManager::FinishDragging() {
247 // Note, dragged panel may be null if the panel was just attached to the
248 // panel layout.
249 dragged_panel_ = NULL; 246 dragged_panel_ = NULL;
250 Relayout(); 247 Relayout();
251 } 248 }
252 249
253 void PanelLayoutManager::SetLauncher(ash::Launcher* launcher) { 250 void PanelLayoutManager::SetLauncher(ash::Launcher* launcher) {
254 launcher_ = launcher; 251 launcher_ = launcher;
255 launcher_->AddIconObserver(this); 252 launcher_->AddIconObserver(this);
256 } 253 }
257 254
258 void PanelLayoutManager::ToggleMinimize(aura::Window* panel) { 255 void PanelLayoutManager::ToggleMinimize(aura::Window* panel) {
(...skipping 13 matching lines...) Expand all
272 } 269 }
273 270
274 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { 271 void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
275 if (child->type() == aura::client::WINDOW_TYPE_POPUP) 272 if (child->type() == aura::client::WINDOW_TYPE_POPUP)
276 return; 273 return;
277 PanelInfo panel_info; 274 PanelInfo panel_info;
278 panel_info.window = child; 275 panel_info.window = child;
279 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); 276 panel_info.callout_widget = new PanelCalloutWidget(panel_container_);
280 panel_windows_.push_back(panel_info); 277 panel_windows_.push_back(panel_info);
281 child->AddObserver(this); 278 child->AddObserver(this);
282 Relayout(); 279 // When dragging a panel on the default container it is temporarily added to
280 // the panel container and doesn't require a relayout.
281 if (child != dragged_panel_)
282 Relayout();
283 } 283 }
284 284
285 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { 285 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
286 } 286 }
287 287
288 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { 288 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
289 if (child->type() == aura::client::WINDOW_TYPE_POPUP) 289 if (child->type() == aura::client::WINDOW_TYPE_POPUP)
290 return; 290 return;
291 PanelList::iterator found = 291 PanelList::iterator found =
292 std::find(panel_windows_.begin(), panel_windows_.end(), child); 292 std::find(panel_windows_.begin(), panel_windows_.end(), child);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds); 620 SetChildBoundsDirect(callout_widget->GetNativeWindow(), callout_bounds);
621 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(), 621 panel_container_->StackChildAbove(callout_widget->GetNativeWindow(),
622 panel); 622 panel);
623 callout_widget->Show(); 623 callout_widget->Show();
624 } 624 }
625 } 625 }
626 626
627 } // namespace internal 627 } // namespace internal
628 } // namespace ash 628 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698