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

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

Issue 231733004: Merge 260031 "Fix infinite recursion on hiding panel when create..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1847/src/
Patch Set: Created 6 years, 8 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.h ('k') | no next file » | 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_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/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 PanelInfo panel_info; 363 PanelInfo panel_info;
364 panel_info.window = child; 364 panel_info.window = child;
365 panel_info.callout_widget = new PanelCalloutWidget(panel_container_); 365 panel_info.callout_widget = new PanelCalloutWidget(panel_container_);
366 if (child != dragged_panel_) { 366 if (child != dragged_panel_) {
367 // Set the panel to 0 opacity until it has been positioned to prevent it 367 // Set the panel to 0 opacity until it has been positioned to prevent it
368 // from flashing briefly at position (0, 0). 368 // from flashing briefly at position (0, 0).
369 child->layer()->SetOpacity(0); 369 child->layer()->SetOpacity(0);
370 panel_info.slide_in = true; 370 panel_info.slide_in = true;
371 } 371 }
372 panel_windows_.push_back(panel_info); 372 panel_windows_.push_back(panel_info);
373 child->AddObserver(this);
374 wm::GetWindowState(child)->AddObserver(this); 373 wm::GetWindowState(child)->AddObserver(this);
375 Relayout(); 374 Relayout();
376 } 375 }
377 376
378 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { 377 void PanelLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
379 } 378 }
380 379
381 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { 380 void PanelLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
382 if (child->type() == ui::wm::WINDOW_TYPE_POPUP) 381 if (child->type() == ui::wm::WINDOW_TYPE_POPUP)
383 return; 382 return;
384 PanelList::iterator found = 383 PanelList::iterator found =
385 std::find(panel_windows_.begin(), panel_windows_.end(), child); 384 std::find(panel_windows_.begin(), panel_windows_.end(), child);
386 if (found != panel_windows_.end()) { 385 if (found != panel_windows_.end()) {
387 delete found->callout_widget; 386 delete found->callout_widget;
388 panel_windows_.erase(found); 387 panel_windows_.erase(found);
389 } 388 }
390 child->RemoveObserver(this);
391 wm::GetWindowState(child)->RemoveObserver(this); 389 wm::GetWindowState(child)->RemoveObserver(this);
392 390
393 if (dragged_panel_ == child) 391 if (dragged_panel_ == child)
394 dragged_panel_ = NULL; 392 dragged_panel_ = NULL;
395 393
396 if (last_active_panel_ == child) 394 if (last_active_panel_ == child)
397 last_active_panel_ = NULL; 395 last_active_panel_ = NULL;
398 396
399 Relayout(); 397 Relayout();
400 } 398 }
401 399
402 void PanelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, 400 void PanelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
403 bool visible) { 401 bool visible) {
402 if (visible)
403 wm::GetWindowState(child)->Restore();
404 Relayout(); 404 Relayout();
405 } 405 }
406 406
407 void PanelLayoutManager::SetChildBounds(aura::Window* child, 407 void PanelLayoutManager::SetChildBounds(aura::Window* child,
408 const gfx::Rect& requested_bounds) { 408 const gfx::Rect& requested_bounds) {
409 gfx::Rect bounds(requested_bounds); 409 gfx::Rect bounds(requested_bounds);
410 const gfx::Rect& max_bounds = panel_container_->GetRootWindow()->bounds(); 410 const gfx::Rect& max_bounds = panel_container_->GetRootWindow()->bounds();
411 const int max_width = max_bounds.width() * kMaxWidthFactor; 411 const int max_width = max_bounds.width() * kMaxWidthFactor;
412 const int max_height = max_bounds.height() * kMaxHeightFactor; 412 const int max_height = max_bounds.height() * kMaxHeightFactor;
413 if (bounds.width() > max_width) 413 if (bounds.width() > max_width)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 473 }
474 return; 474 return;
475 } 475 }
476 476
477 if (window_state->IsMinimized()) 477 if (window_state->IsMinimized())
478 MinimizePanel(window_state->window()); 478 MinimizePanel(window_state->window());
479 else 479 else
480 RestorePanel(window_state->window()); 480 RestorePanel(window_state->window());
481 } 481 }
482 482
483 void PanelLayoutManager::OnWindowVisibilityChanged(
484 aura::Window* window, bool visible) {
485 if (visible)
486 wm::GetWindowState(window)->Restore();
487 }
488
489 //////////////////////////////////////////////////////////////////////////////// 483 ////////////////////////////////////////////////////////////////////////////////
490 // PanelLayoutManager, aura::client::ActivationChangeObserver implementation: 484 // PanelLayoutManager, aura::client::ActivationChangeObserver implementation:
491 485
492 void PanelLayoutManager::OnWindowActivated(aura::Window* gained_active, 486 void PanelLayoutManager::OnWindowActivated(aura::Window* gained_active,
493 aura::Window* lost_active) { 487 aura::Window* lost_active) {
494 // Ignore if the panel that is not managed by this was activated. 488 // Ignore if the panel that is not managed by this was activated.
495 if (gained_active && gained_active->type() == ui::wm::WINDOW_TYPE_PANEL && 489 if (gained_active && gained_active->type() == ui::wm::WINDOW_TYPE_PANEL &&
496 gained_active->parent() == panel_container_) { 490 gained_active->parent() == panel_container_) {
497 UpdateStacking(gained_active); 491 UpdateStacking(gained_active);
498 UpdateCallouts(); 492 UpdateCallouts();
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 878
885 void PanelLayoutManager::OnKeyboardBoundsChanging( 879 void PanelLayoutManager::OnKeyboardBoundsChanging(
886 const gfx::Rect& keyboard_bounds) { 880 const gfx::Rect& keyboard_bounds) {
887 // This bounds change will have caused a change to the Shelf which does not 881 // This bounds change will have caused a change to the Shelf which does not
888 // propogate automatically to this class, so manually recalculate bounds. 882 // propogate automatically to this class, so manually recalculate bounds.
889 OnWindowResized(); 883 OnWindowResized();
890 } 884 }
891 885
892 } // namespace internal 886 } // namespace internal
893 } // namespace ash 887 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698