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

Unified Diff: ash/wm/overview/scoped_transform_overview_window.cc

Issue 844763006: Change overview mode to so that docked panel windows are not grouped together. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed stale pointer in ScopedTransformOverviewWindow. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/overview/scoped_transform_overview_window.h ('k') | ash/wm/overview/scoped_window_copy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/overview/scoped_transform_overview_window.cc
diff --git a/ash/wm/overview/scoped_transform_overview_window.cc b/ash/wm/overview/scoped_transform_overview_window.cc
index 41205bf64ff8fa666af1e75383bee1332d400f6a..5d2734d21acd59045003906424133a33e22bc221 100644
--- a/ash/wm/overview/scoped_transform_overview_window.cc
+++ b/ash/wm/overview/scoped_transform_overview_window.cc
@@ -10,7 +10,6 @@
#include "ash/screen_util.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/overview/scoped_overview_animation_settings.h"
-#include "ash/wm/overview/scoped_window_copy.h"
#include "ash/wm/overview/window_selector_item.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
@@ -175,36 +174,37 @@ ScopedTransformOverviewWindow::ScopedTransformOverviewWindow(
overview_started_(false),
original_transform_(window->layer()->GetTargetTransform()),
original_opacity_(window->layer()->GetTargetOpacity()) {
+ DCHECK(window_);
}
ScopedTransformOverviewWindow::~ScopedTransformOverviewWindow() {
- if (window_) {
- ScopedAnimationSettings animation_settings_list;
- BeginScopedAnimation(
- OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW,
- &animation_settings_list);
- SetTransform(window()->GetRootWindow(), original_transform_);
-
- ScopedOverviewAnimationSettings animation_settings(
- OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS,
- window_);
- gfx::Transform transform;
- if (minimized_ && window_->GetProperty(aura::client::kShowStateKey) !=
- ui::SHOW_STATE_MINIMIZED) {
- // Setting opacity 0 and visible false ensures that the property change
- // to SHOW_STATE_MINIMIZED will not animate the window from its original
- // bounds to the minimized position.
- // Hiding the window needs to be done before the target opacity is 0,
- // otherwise the layer's visibility will not be updated
- // (See VisibilityController::UpdateLayerVisibility).
- window_->Hide();
- window_->layer()->SetOpacity(0);
- window_->SetProperty(aura::client::kShowStateKey,
- ui::SHOW_STATE_MINIMIZED);
- }
- wm::GetWindowState(window_)->set_ignored_by_shelf(ignored_by_shelf_);
- SetOpacity(original_opacity_);
+}
+
+void ScopedTransformOverviewWindow::RestoreWindow() {
+ ScopedAnimationSettings animation_settings_list;
+ BeginScopedAnimation(
+ OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW,
+ &animation_settings_list);
+ SetTransform(window()->GetRootWindow(), original_transform_);
+
+ ScopedOverviewAnimationSettings animation_settings(
+ OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS,
+ window_);
+ gfx::Transform transform;
+ if (minimized_ && window_->GetProperty(aura::client::kShowStateKey) !=
+ ui::SHOW_STATE_MINIMIZED) {
+ // Setting opacity 0 and visible false ensures that the property change
+ // to SHOW_STATE_MINIMIZED will not animate the window from its original
+ // bounds to the minimized position.
+ // Hiding the window needs to be done before the target opacity is 0,
+ // otherwise the layer's visibility will not be updated
+ // (See VisibilityController::UpdateLayerVisibility).
+ window_->Hide();
+ window_->layer()->SetOpacity(0);
+ window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
}
+ wm::GetWindowState(window_)->set_ignored_by_shelf(ignored_by_shelf_);
+ SetOpacity(original_opacity_);
}
void ScopedTransformOverviewWindow::BeginScopedAnimation(
@@ -233,17 +233,19 @@ gfx::Rect ScopedTransformOverviewWindow::GetTargetBoundsInScreen() const {
return bounds;
}
-void ScopedTransformOverviewWindow::RestoreWindow() {
+void ScopedTransformOverviewWindow::ShowWindowIfMinimized() {
if (minimized_ && window_->GetProperty(aura::client::kShowStateKey) ==
ui::SHOW_STATE_MINIMIZED) {
window_->Show();
}
}
-void ScopedTransformOverviewWindow::RestoreWindowOnExit() {
- minimized_ = false;
- original_transform_ = gfx::Transform();
- original_opacity_ = kRestoreWindowOpacity;
+void ScopedTransformOverviewWindow::ShowWindowOnExit() {
+ if (minimized_) {
+ minimized_ = false;
+ original_transform_ = gfx::Transform();
+ original_opacity_ = kRestoreWindowOpacity;
+ }
}
void ScopedTransformOverviewWindow::OnWindowDestroyed() {
@@ -315,7 +317,7 @@ void ScopedTransformOverviewWindow::PrepareForOverview() {
DCHECK(!overview_started_);
overview_started_ = true;
wm::GetWindowState(window_)->set_ignored_by_shelf(true);
- RestoreWindow();
+ ShowWindowIfMinimized();
}
} // namespace ash
« no previous file with comments | « ash/wm/overview/scoped_transform_overview_window.h ('k') | ash/wm/overview/scoped_window_copy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698