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

Side by Side Diff: ash/common/wm/default_state.cc

Issue 2778733004: Add WindowPinType property on arua::Window (Closed)
Patch Set: Address review issues. Created 3 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
« no previous file with comments | « no previous file | ash/common/wm/lock_window_state.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/wm/default_state.h" 5 #include "ash/common/wm/default_state.h"
6 6
7 #include "ash/common/wm/window_animation_types.h" 7 #include "ash/common/wm/window_animation_types.h"
8 #include "ash/common/wm/window_parenting_utils.h" 8 #include "ash/common/wm/window_parenting_utils.h"
9 #include "ash/common/wm/window_positioning_utils.h" 9 #include "ash/common/wm/window_positioning_utils.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 void DefaultState::EnterToNextState(WindowState* window_state, 478 void DefaultState::EnterToNextState(WindowState* window_state,
479 WindowStateType next_state_type) { 479 WindowStateType next_state_type) {
480 // Do nothing if we're already in the same state. 480 // Do nothing if we're already in the same state.
481 if (state_type_ == next_state_type) 481 if (state_type_ == next_state_type)
482 return; 482 return;
483 483
484 WindowStateType previous_state_type = state_type_; 484 WindowStateType previous_state_type = state_type_;
485 state_type_ = next_state_type; 485 state_type_ = next_state_type;
486 486
487 window_state->UpdateWindowShowStateFromStateType(); 487 window_state->UpdateWindowPropertiesFromStateType();
488 window_state->NotifyPreStateTypeChange(previous_state_type); 488 window_state->NotifyPreStateTypeChange(previous_state_type);
489 489
490 if (window_state->window()->GetParent()) { 490 if (window_state->window()->GetParent()) {
491 if (!window_state->HasRestoreBounds() && 491 if (!window_state->HasRestoreBounds() &&
492 (previous_state_type == WINDOW_STATE_TYPE_DEFAULT || 492 (previous_state_type == WINDOW_STATE_TYPE_DEFAULT ||
493 previous_state_type == WINDOW_STATE_TYPE_NORMAL) && 493 previous_state_type == WINDOW_STATE_TYPE_NORMAL) &&
494 !window_state->IsMinimized() && !window_state->IsNormalStateType()) { 494 !window_state->IsMinimized() && !window_state->IsNormalStateType()) {
495 window_state->SaveCurrentBoundsForRestore(); 495 window_state->SaveCurrentBoundsForRestore();
496 } 496 }
497 497
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 if (previous_state_type == wm::WINDOW_STATE_TYPE_FULLSCREEN || 541 if (previous_state_type == wm::WINDOW_STATE_TYPE_FULLSCREEN ||
542 previous_state_type == wm::WINDOW_STATE_TYPE_PINNED || 542 previous_state_type == wm::WINDOW_STATE_TYPE_PINNED ||
543 previous_state_type == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED) { 543 previous_state_type == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED) {
544 state_type_ = previous_state_type; 544 state_type_ = previous_state_type;
545 } else if (state_type_ == wm::WINDOW_STATE_TYPE_FULLSCREEN || 545 } else if (state_type_ == wm::WINDOW_STATE_TYPE_FULLSCREEN ||
546 state_type_ == wm::WINDOW_STATE_TYPE_PINNED || 546 state_type_ == wm::WINDOW_STATE_TYPE_PINNED ||
547 state_type_ == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED) { 547 state_type_ == wm::WINDOW_STATE_TYPE_TRUSTED_PINNED) {
548 state_type_ = previous_state_type; 548 state_type_ = previous_state_type;
549 } 549 }
550 550
551 window_state->UpdateWindowShowStateFromStateType(); 551 window_state->UpdateWindowPropertiesFromStateType();
552 window_state->NotifyPreStateTypeChange(previous_state_type); 552 window_state->NotifyPreStateTypeChange(previous_state_type);
553 553
554 if ((state_type_ == wm::WINDOW_STATE_TYPE_NORMAL || 554 if ((state_type_ == wm::WINDOW_STATE_TYPE_NORMAL ||
555 state_type_ == wm::WINDOW_STATE_TYPE_DEFAULT) && 555 state_type_ == wm::WINDOW_STATE_TYPE_DEFAULT) &&
556 !stored_bounds_.IsEmpty()) { 556 !stored_bounds_.IsEmpty()) {
557 // Use the restore mechanism to set the bounds for 557 // Use the restore mechanism to set the bounds for
558 // the window in normal state. This also covers unminimize case. 558 // the window in normal state. This also covers unminimize case.
559 window_state->SetRestoreBoundsInParent(stored_bounds_); 559 window_state->SetRestoreBoundsInParent(stored_bounds_);
560 } 560 }
561 561
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 688 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
689 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 689 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
690 window_state->SetBoundsDirectAnimated(center_in_parent); 690 window_state->SetBoundsDirectAnimated(center_in_parent);
691 } 691 }
692 // Centering window is treated as if a user moved and resized the window. 692 // Centering window is treated as if a user moved and resized the window.
693 window_state->set_bounds_changed_by_user(true); 693 window_state->set_bounds_changed_by_user(true);
694 } 694 }
695 695
696 } // namespace wm 696 } // namespace wm
697 } // namespace ash 697 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm/lock_window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698