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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 13934007: Adding experimental maximize mode (behind a flag) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Step back and a few changes 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
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/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/session_state_delegate.h" 9 #include "ash/session_state_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/wm/always_on_top_controller.h" 11 #include "ash/wm/always_on_top_controller.h"
12 #include "ash/wm/base_layout_manager.h" 12 #include "ash/wm/base_layout_manager.h"
13 #include "ash/wm/window_animations.h" 13 #include "ash/wm/window_animations.h"
14 #include "ash/wm/window_properties.h" 14 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
16 #include "ash/wm/workspace/workspace.h" 16 #include "ash/wm/workspace/workspace.h"
17 #include "ash/wm/workspace/workspace_manager.h" 17 #include "ash/wm/workspace/workspace_manager.h"
18 #include "ash/wm/workspace/workspace_window_resizer.h" 18 #include "ash/wm/workspace/workspace_window_resizer.h"
19 #include "base/auto_reset.h" 19 #include "base/auto_reset.h"
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "ui/aura/client/aura_constants.h" 21 #include "ui/aura/client/aura_constants.h"
22 #include "ui/aura/root_window.h" 22 #include "ui/aura/root_window.h"
23 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
24 #include "ui/aura/window_observer.h" 24 #include "ui/aura/window_observer.h"
25 #include "ui/base/events/event.h" 25 #include "ui/base/events/event.h"
26 #include "ui/base/ui_base_types.h" 26 #include "ui/base/ui_base_types.h"
27 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
27 #include "ui/views/corewm/window_util.h" 28 #include "ui/views/corewm/window_util.h"
28 29
29 using aura::Window; 30 using aura::Window;
30 31
31 namespace ash { 32 namespace ash {
32 33
33 namespace internal { 34 namespace internal {
34 35
35 namespace { 36 namespace {
36 37
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent( 164 const gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
164 workspace_->window()->parent())); 165 workspace_->window()->parent()));
165 if (work_area != work_area_) 166 if (work_area != work_area_)
166 AdjustWindowSizesForScreenChange(ADJUST_WINDOW_DISPLAY_INSETS_CHANGED); 167 AdjustWindowSizesForScreenChange(ADJUST_WINDOW_DISPLAY_INSETS_CHANGED);
167 } 168 }
168 } 169 }
169 170
170 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window, 171 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
171 const void* key, 172 const void* key,
172 intptr_t old) { 173 intptr_t old) {
174 if (key == ash::internal::kWindowPersistsAcrossAllWorkspacesKey &&
sky 2013/05/01 04:32:04 I don't think you intended to keep this.
Mr4D (OOO till 08-26) 2013/05/01 17:57:23 Ahh. No problem. Removed and reverted back to what
175 ash::Shell::IsForcedMaximizeMode()) {
176 // Since this flag can only be set after creation, but it is not dynamic,
177 // we want this flag to be executed immediately without animations.
178 scoped_ptr<ui::ScopedAnimationDurationScaleMode> animation_duration(
179 new ui::ScopedAnimationDurationScaleMode(
180 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
181 if (GetPersistsAcrossAllWorkspaces(window)) {
182 if (wm::IsWindowMaximized(window))
183 wm::RestoreWindow(window);
184 } else {
185 if (!wm::IsWindowMaximized(window))
186 wm::MaximizeWindow(window);
187 }
188 }
189
173 if (key == aura::client::kShowStateKey) { 190 if (key == aura::client::kShowStateKey) {
174 ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old); 191 ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old);
175 ui::WindowShowState new_state = 192 ui::WindowShowState new_state =
176 window->GetProperty(aura::client::kShowStateKey); 193 window->GetProperty(aura::client::kShowStateKey);
177 if (old_state != ui::SHOW_STATE_MINIMIZED && 194 if (old_state != ui::SHOW_STATE_MINIMIZED &&
178 GetRestoreBoundsInScreen(window) == NULL && 195 GetRestoreBoundsInScreen(window) == NULL &&
179 WorkspaceManager::IsMaximizedState(new_state) && 196 WorkspaceManager::IsMaximizedState(new_state) &&
180 !WorkspaceManager::IsMaximizedState(old_state)) { 197 !WorkspaceManager::IsMaximizedState(old_state)) {
181 SetRestoreBoundsInParent(window, window->bounds()); 198 SetRestoreBoundsInParent(window, window->bounds());
182 } 199 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 403 }
387 return false; 404 return false;
388 } 405 }
389 406
390 WorkspaceManager* WorkspaceLayoutManager::workspace_manager() { 407 WorkspaceManager* WorkspaceLayoutManager::workspace_manager() {
391 return workspace_->workspace_manager(); 408 return workspace_->workspace_manager();
392 } 409 }
393 410
394 } // namespace internal 411 } // namespace internal
395 } // namespace ash 412 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698