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

Side by Side Diff: ash/wm/base_layout_manager.cc

Issue 14663010: Save and restore State for ShellWindows, including panels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | ash/wm/window_properties.h » ('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/base_layout_manager.h" 5 #include "ash/wm/base_layout_manager.h"
6 6
7 #include "ash/screen_ash.h" 7 #include "ash/screen_ash.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/window_animations.h" 10 #include "ash/wm/window_animations.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 void BaseLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { 84 void BaseLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
85 } 85 }
86 86
87 void BaseLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, 87 void BaseLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
88 bool visible) { 88 bool visible) {
89 if (visible && wm::IsWindowMinimized(child)) { 89 if (visible && wm::IsWindowMinimized(child)) {
90 // Attempting to show a minimized window. Unminimize it. 90 // Attempting to show a minimized window. Unminimize it.
91 child->SetProperty(aura::client::kShowStateKey, 91 child->SetProperty(aura::client::kShowStateKey,
92 child->GetProperty(internal::kRestoreShowStateKey)); 92 child->GetProperty(aura::client::kRestoreShowStateKey));
93 child->ClearProperty(internal::kRestoreShowStateKey); 93 child->ClearProperty(aura::client::kRestoreShowStateKey);
94 } 94 }
95 } 95 }
96 96
97 void BaseLayoutManager::SetChildBounds(aura::Window* child, 97 void BaseLayoutManager::SetChildBounds(aura::Window* child,
98 const gfx::Rect& requested_bounds) { 98 const gfx::Rect& requested_bounds) {
99 gfx::Rect child_bounds(requested_bounds); 99 gfx::Rect child_bounds(requested_bounds);
100 // Some windows rely on this to set their initial bounds. 100 // Some windows rely on this to set their initial bounds.
101 if (wm::IsWindowMaximized(child)) 101 if (wm::IsWindowMaximized(child))
102 child_bounds = ScreenAsh::GetMaximizedWindowBoundsInParent(child); 102 child_bounds = ScreenAsh::GetMaximizedWindowBoundsInParent(child);
103 else if (wm::IsWindowFullscreen(child)) 103 else if (wm::IsWindowFullscreen(child))
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 } 165 }
166 166
167 ////////////////////////////////////////////////////////////////////////////// 167 //////////////////////////////////////////////////////////////////////////////
168 // BaseLayoutManager, private: 168 // BaseLayoutManager, private:
169 169
170 void BaseLayoutManager::ShowStateChanged(aura::Window* window, 170 void BaseLayoutManager::ShowStateChanged(aura::Window* window,
171 ui::WindowShowState last_show_state) { 171 ui::WindowShowState last_show_state) {
172 if (wm::IsWindowMinimized(window)) { 172 if (wm::IsWindowMinimized(window)) {
173 // Save the previous show state so that we can correctly restore it. 173 // Save the previous show state so that we can correctly restore it.
174 window->SetProperty(internal::kRestoreShowStateKey, last_show_state); 174 window->SetProperty(aura::client::kRestoreShowStateKey, last_show_state);
175 views::corewm::SetWindowVisibilityAnimationType( 175 views::corewm::SetWindowVisibilityAnimationType(
176 window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE); 176 window, WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
177 177
178 // Hide the window. 178 // Hide the window.
179 window->Hide(); 179 window->Hide();
180 // Activate another window. 180 // Activate another window.
181 if (wm::IsActiveWindow(window)) 181 if (wm::IsActiveWindow(window))
182 wm::DeactivateWindow(window); 182 wm::DeactivateWindow(window);
183 } else if ((window->TargetVisibility() || 183 } else if ((window->TargetVisibility() ||
184 last_show_state == ui::SHOW_STATE_MINIMIZED) && 184 last_show_state == ui::SHOW_STATE_MINIMIZED) &&
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // Put as much of the window as possible within the display area. 245 // Put as much of the window as possible within the display area.
246 gfx::Rect bounds = window->bounds(); 246 gfx::Rect bounds = window->bounds();
247 bounds.AdjustToFit(display_rect); 247 bounds.AdjustToFit(display_rect);
248 window->SetBounds(bounds); 248 window->SetBounds(bounds);
249 } 249 }
250 } 250 }
251 } 251 }
252 252
253 } // namespace internal 253 } // namespace internal
254 } // namespace ash 254 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698