| OLD | NEW |
| 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_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf_layout_manager.h" | 7 #include "ash/shelf/shelf_layout_manager.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/base_layout_manager.h" | 10 #include "ash/wm/base_layout_manager.h" |
| 11 #include "ash/wm/property_util.h" | |
| 12 #include "ash/wm/window_animations.h" | 11 #include "ash/wm/window_animations.h" |
| 13 #include "ash/wm/window_settings.h" | 12 #include "ash/wm/window_state.h" |
| 14 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 15 #include "ash/wm/workspace/workspace_event_handler.h" | 14 #include "ash/wm/workspace/workspace_event_handler.h" |
| 16 #include "ash/wm/workspace/workspace_layout_manager.h" | 15 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 17 #include "ui/aura/client/activation_client.h" | 16 #include "ui/aura/client/activation_client.h" |
| 18 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
| 19 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
| 20 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 21 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
| 22 #include "ui/compositor/scoped_layer_animation_settings.h" | 21 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 23 #include "ui/views/corewm/visibility_controller.h" | 22 #include "ui/views/corewm/visibility_controller.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 WorkspaceWindowState WorkspaceController::GetWindowState() const { | 57 WorkspaceWindowState WorkspaceController::GetWindowState() const { |
| 59 if (!shelf_) | 58 if (!shelf_) |
| 60 return WORKSPACE_WINDOW_STATE_DEFAULT; | 59 return WORKSPACE_WINDOW_STATE_DEFAULT; |
| 61 | 60 |
| 62 const gfx::Rect shelf_bounds(shelf_->GetIdealBounds()); | 61 const gfx::Rect shelf_bounds(shelf_->GetIdealBounds()); |
| 63 const aura::Window::Windows& windows(viewport_->children()); | 62 const aura::Window::Windows& windows(viewport_->children()); |
| 64 bool window_overlaps_launcher = false; | 63 bool window_overlaps_launcher = false; |
| 65 bool has_maximized_window = false; | 64 bool has_maximized_window = false; |
| 66 for (aura::Window::Windows::const_iterator i = windows.begin(); | 65 for (aura::Window::Windows::const_iterator i = windows.begin(); |
| 67 i != windows.end(); ++i) { | 66 i != windows.end(); ++i) { |
| 68 if (wm::GetWindowSettings(*i)->ignored_by_shelf()) | 67 wm::WindowState* window_state = wm::GetWindowState(*i); |
| 68 if (window_state->ignored_by_shelf()) |
| 69 continue; | 69 continue; |
| 70 ui::Layer* layer = (*i)->layer(); | 70 ui::Layer* layer = (*i)->layer(); |
| 71 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f) | 71 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f) |
| 72 continue; | 72 continue; |
| 73 if (wm::IsWindowMaximized(*i)) { | 73 if (window_state->IsMaximized()) { |
| 74 // An untracked window may still be fullscreen so we keep iterating when | 74 // An untracked window may still be fullscreen so we keep iterating when |
| 75 // we hit a maximized window. | 75 // we hit a maximized window. |
| 76 has_maximized_window = true; | 76 has_maximized_window = true; |
| 77 } else if (wm::IsWindowFullscreen(*i)) { | 77 } else if (window_state->IsFullscreen()) { |
| 78 return WORKSPACE_WINDOW_STATE_FULL_SCREEN; | 78 return WORKSPACE_WINDOW_STATE_FULL_SCREEN; |
| 79 } | 79 } |
| 80 if (!window_overlaps_launcher && (*i)->bounds().Intersects(shelf_bounds)) | 80 if (!window_overlaps_launcher && (*i)->bounds().Intersects(shelf_bounds)) |
| 81 window_overlaps_launcher = true; | 81 window_overlaps_launcher = true; |
| 82 } | 82 } |
| 83 if (has_maximized_window) | 83 if (has_maximized_window) |
| 84 return WORKSPACE_WINDOW_STATE_MAXIMIZED; | 84 return WORKSPACE_WINDOW_STATE_MAXIMIZED; |
| 85 | 85 |
| 86 return window_overlaps_launcher ? | 86 return window_overlaps_launcher ? |
| 87 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF : | 87 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF : |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 settings.SetTweenType(gfx::Tween::EASE_OUT); | 119 settings.SetTweenType(gfx::Tween::EASE_OUT); |
| 120 settings.SetTransitionDuration( | 120 settings.SetTransitionDuration( |
| 121 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); | 121 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); |
| 122 viewport_->layer()->SetTransform(gfx::Transform()); | 122 viewport_->layer()->SetTransform(gfx::Transform()); |
| 123 viewport_->layer()->SetOpacity(1.0f); | 123 viewport_->layer()->SetOpacity(1.0f); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace internal | 127 } // namespace internal |
| 128 } // namespace ash | 128 } // namespace ash |
| OLD | NEW |