Chromium Code Reviews| 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/window_util.h" | 5 #include "ash/wm/window_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/activation_controller.h" | 10 #include "ash/wm/activation_controller.h" |
| 11 #include "ash/wm/window_properties.h" | 11 #include "ash/wm/window_properties.h" |
| 12 #include "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
| 13 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
| 14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 #include "ui/compositor/layer.h" | 16 #include "ui/compositor/layer.h" |
| 17 #include "ui/views/widget/widget.h" | |
| 18 #include "ui/views/widget/widget_delegate.h" | |
| 17 #include "ui/gfx/display.h" | 19 #include "ui/gfx/display.h" |
| 18 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
| 19 | 21 |
| 20 namespace ash { | 22 namespace ash { |
| 21 namespace wm { | 23 namespace wm { |
| 22 | 24 |
| 23 void ActivateWindow(aura::Window* window) { | 25 void ActivateWindow(aura::Window* window) { |
| 24 DCHECK(window); | 26 DCHECK(window); |
| 25 DCHECK(window->GetRootWindow()); | 27 DCHECK(window->GetRootWindow()); |
| 26 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow( | 28 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow( |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 54 | 56 |
| 55 bool CanActivateWindow(aura::Window* window) { | 57 bool CanActivateWindow(aura::Window* window) { |
| 56 DCHECK(window); | 58 DCHECK(window); |
| 57 if (!window->GetRootWindow()) | 59 if (!window->GetRootWindow()) |
| 58 return false; | 60 return false; |
| 59 aura::client::ActivationClient* client = | 61 aura::client::ActivationClient* client = |
| 60 aura::client::GetActivationClient(window->GetRootWindow()); | 62 aura::client::GetActivationClient(window->GetRootWindow()); |
| 61 return client && client->CanActivateWindow(window); | 63 return client && client->CanActivateWindow(window); |
| 62 } | 64 } |
| 63 | 65 |
| 66 bool CanMaximizeWindow(aura::Window* window) { | |
| 67 if (!window) | |
| 68 return false; | |
| 69 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); | |
|
sky
2012/09/13 00:46:22
Instead of this, add a new property that says whet
sschmitz
2012/09/13 19:34:13
Thanks for your help on this.
Done.
| |
| 70 if (!widget) | |
| 71 return false; | |
| 72 views::WidgetDelegate* widget_delegate = widget->widget_delegate(); | |
| 73 if (!widget_delegate) | |
| 74 return false; | |
| 75 return widget_delegate->CanMaximize(); | |
| 76 } | |
| 77 | |
| 64 bool IsWindowNormal(aura::Window* window) { | 78 bool IsWindowNormal(aura::Window* window) { |
| 65 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); | 79 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); |
| 66 } | 80 } |
| 67 | 81 |
| 68 bool IsWindowStateNormal(ui::WindowShowState state) { | 82 bool IsWindowStateNormal(ui::WindowShowState state) { |
| 69 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 83 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; |
| 70 } | 84 } |
| 71 | 85 |
| 72 bool IsWindowMaximized(aura::Window* window) { | 86 bool IsWindowMaximized(aura::Window* window) { |
| 73 return window->GetProperty(aura::client::kShowStateKey) == | 87 return window->GetProperty(aura::client::kShowStateKey) == |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 it != children.end(); | 137 it != children.end(); |
| 124 ++it) { | 138 ++it) { |
| 125 ui::Layer* child = *it; | 139 ui::Layer* child = *it; |
| 126 DeepDeleteLayers(child); | 140 DeepDeleteLayers(child); |
| 127 } | 141 } |
| 128 delete layer; | 142 delete layer; |
| 129 } | 143 } |
| 130 | 144 |
| 131 } // namespace wm | 145 } // namespace wm |
| 132 } // namespace ash | 146 } // namespace ash |
| OLD | NEW |