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/workspace.h" | 5 #include "ash/wm/workspace/workspace.h" |
6 | 6 |
7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
8 #include "ash/wm/property_util.h" | 8 #include "ash/wm/property_util.h" |
9 #include "ash/wm/window_animations.h" | 9 #include "ash/wm/window_animations.h" |
10 #include "ash/wm/window_properties.h" | 10 #include "ash/wm/window_properties.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 aura::Window* Workspace::ReleaseWindow() { | 51 aura::Window* Workspace::ReleaseWindow() { |
52 // Remove the LayoutManager and EventFilter as they refer back to us and/or | 52 // Remove the LayoutManager and EventFilter as they refer back to us and/or |
53 // WorkspaceManager. | 53 // WorkspaceManager. |
54 window_->SetLayoutManager(NULL); | 54 window_->SetLayoutManager(NULL); |
55 window_->SetEventFilter(NULL); | 55 window_->SetEventFilter(NULL); |
56 aura::Window* window = window_; | 56 aura::Window* window = window_; |
57 window_ = NULL; | 57 window_ = NULL; |
58 return window; | 58 return window; |
59 } | 59 } |
60 | 60 |
61 aura::Window* Workspace::GetActiveWindow() const { | |
62 aura::Window* active_window = wm::GetActiveWindow(); | |
sky
2012/11/28 15:15:34
Did you see my earlier comment on this? I believe
| |
63 if (!active_window) | |
64 return NULL; | |
65 | |
66 // Only return the active window if it is in this workspace. | |
67 aura::Window* window = active_window; | |
68 while (window) { | |
69 if (window == window_) | |
70 return active_window; | |
71 window = window->parent(); | |
72 } | |
73 return NULL; | |
74 } | |
75 | |
61 bool Workspace::ShouldMoveToPending() const { | 76 bool Workspace::ShouldMoveToPending() const { |
62 if (!is_maximized_) | 77 if (!is_maximized_) |
63 return false; | 78 return false; |
64 | 79 |
65 bool has_visible_non_maximized_window = false; | 80 bool has_visible_non_maximized_window = false; |
66 for (size_t i = 0; i < window_->children().size(); ++i) { | 81 for (size_t i = 0; i < window_->children().size(); ++i) { |
67 aura::Window* child(window_->children()[i]); | 82 aura::Window* child(window_->children()[i]); |
68 if (!GetTrackedByWorkspace(child) || !child->TargetVisibility() || | 83 if (!GetTrackedByWorkspace(child) || !child->TargetVisibility() || |
69 wm::IsWindowMinimized(child)) | 84 wm::IsWindowMinimized(child)) |
70 continue; | 85 continue; |
(...skipping 15 matching lines...) Expand all Loading... | |
86 WorkspaceManager::WillRestoreMaximized(child))) { | 101 WorkspaceManager::WillRestoreMaximized(child))) { |
87 if (++count == 2) | 102 if (++count == 2) |
88 return count; | 103 return count; |
89 } | 104 } |
90 } | 105 } |
91 return count; | 106 return count; |
92 } | 107 } |
93 | 108 |
94 } // namespace internal | 109 } // namespace internal |
95 } // namespace ash | 110 } // namespace ash |
OLD | NEW |