OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/wm/window_manager_impl.h" | 5 #include "athena/wm/window_manager_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "athena/screen/public/screen_manager.h" | 9 #include "athena/screen/public/screen_manager.h" |
10 #include "athena/util/container_priorities.h" | 10 #include "athena/util/container_priorities.h" |
11 #include "athena/wm/bezel_controller.h" | 11 #include "athena/wm/bezel_controller.h" |
12 #include "athena/wm/public/window_manager_observer.h" | 12 #include "athena/wm/public/window_manager_observer.h" |
13 #include "athena/wm/split_view_controller.h" | 13 #include "athena/wm/split_view_controller.h" |
14 #include "athena/wm/title_drag_controller.h" | 14 #include "athena/wm/title_drag_controller.h" |
15 #include "athena/wm/window_list_provider_impl.h" | 15 #include "athena/wm/window_list_provider_impl.h" |
16 #include "athena/wm/window_overview_mode.h" | 16 #include "athena/wm/window_overview_mode.h" |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "ui/aura/layout_manager.h" | 19 #include "ui/aura/layout_manager.h" |
20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
21 #include "ui/compositor/closure_animation_observer.h" | 21 #include "ui/compositor/closure_animation_observer.h" |
22 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
23 #include "ui/gfx/display.h" | 23 #include "ui/gfx/display.h" |
24 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
25 #include "ui/wm/core/shadow_controller.h" | 25 #include "ui/wm/core/shadow_controller.h" |
| 26 #include "ui/wm/core/transient_window_manager.h" |
26 #include "ui/wm/core/window_util.h" | 27 #include "ui/wm/core/window_util.h" |
27 #include "ui/wm/core/wm_state.h" | 28 #include "ui/wm/core/wm_state.h" |
28 #include "ui/wm/public/activation_client.h" | 29 #include "ui/wm/public/activation_client.h" |
29 #include "ui/wm/public/window_types.h" | 30 #include "ui/wm/public/window_types.h" |
30 | 31 |
31 namespace athena { | 32 namespace athena { |
32 namespace { | 33 namespace { |
33 class WindowManagerImpl* instance = NULL; | 34 class WindowManagerImpl* instance = NULL; |
34 | 35 |
35 void SetWindowState(aura::Window* window, | 36 void SetWindowState(aura::Window* window, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 gfx::Rect(gfx::Point(split_size.width(), 0), split_size)); | 93 gfx::Rect(gfx::Point(split_size.width(), 0), split_size)); |
93 else | 94 else |
94 window->SetBounds(gfx::Rect(work_area)); | 95 window->SetBounds(gfx::Rect(work_area)); |
95 } else { | 96 } else { |
96 window->SetBounds(gfx::Rect(work_area)); | 97 window->SetBounds(gfx::Rect(work_area)); |
97 } | 98 } |
98 } | 99 } |
99 } | 100 } |
100 | 101 |
101 void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 102 void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
102 if (!instance->window_list_provider_->IsWindowInList(child)) | 103 // TODO(oshima): Split view modes needs to take the transient window into |
| 104 // account. |
| 105 if (wm::GetTransientParent(child)) { |
| 106 wm::TransientWindowManager::Get(child) |
| 107 ->set_parent_controls_visibility(true); |
| 108 } |
| 109 |
| 110 if (!instance->window_list_provider_->IsValidWindow(child)) |
103 return; | 111 return; |
104 | 112 |
105 if (instance->split_view_controller_->IsSplitViewModeActive() && | 113 if (instance->split_view_controller_->IsSplitViewModeActive() && |
106 !instance->IsOverviewModeActive()) { | 114 !instance->IsOverviewModeActive()) { |
107 instance->split_view_controller_->ReplaceWindow( | 115 instance->split_view_controller_->ReplaceWindow( |
108 instance->split_view_controller_->left_window(), child); | 116 instance->split_view_controller_->left_window(), child); |
109 } else { | 117 } else { |
110 gfx::Size size = | 118 gfx::Size size = |
111 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size(); | 119 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size(); |
112 child->SetBounds(gfx::Rect(size)); | 120 child->SetBounds(gfx::Rect(size)); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 container_.get(), window_list_provider_.get(), | 241 container_.get(), window_list_provider_.get(), |
234 split_view_controller_.get(), this); | 242 split_view_controller_.get(), this); |
235 } else { | 243 } else { |
236 overview_.reset(); | 244 overview_.reset(); |
237 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); | 245 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); |
238 } | 246 } |
239 } | 247 } |
240 | 248 |
241 void WindowManagerImpl::InstallAccelerators() { | 249 void WindowManagerImpl::InstallAccelerators() { |
242 const AcceleratorData accelerator_data[] = { | 250 const AcceleratorData accelerator_data[] = { |
243 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW, | 251 {TRIGGER_ON_PRESS, |
| 252 ui::VKEY_F6, |
| 253 ui::EF_NONE, |
| 254 CMD_TOGGLE_OVERVIEW, |
244 AF_NONE}, | 255 AF_NONE}, |
245 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN, | 256 {TRIGGER_ON_PRESS, |
246 CMD_TOGGLE_SPLIT_VIEW, AF_NONE}, | 257 ui::VKEY_F6, |
| 258 ui::EF_CONTROL_DOWN, |
| 259 CMD_TOGGLE_SPLIT_VIEW, |
| 260 AF_NONE}, |
| 261 // Debug |
| 262 {TRIGGER_ON_PRESS, |
| 263 ui::VKEY_6, |
| 264 ui::EF_NONE, |
| 265 CMD_TOGGLE_OVERVIEW, |
| 266 AF_NONE | AF_DEBUG}, |
247 }; | 267 }; |
248 AcceleratorManager::Get()->RegisterAccelerators( | 268 AcceleratorManager::Get()->RegisterAccelerators( |
249 accelerator_data, arraysize(accelerator_data), this); | 269 accelerator_data, arraysize(accelerator_data), this); |
250 } | 270 } |
251 | 271 |
252 void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) { | 272 void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) { |
253 observers_.AddObserver(observer); | 273 observers_.AddObserver(observer); |
254 } | 274 } |
255 | 275 |
256 void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { | 276 void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 DCHECK(!instance); | 445 DCHECK(!instance); |
426 } | 446 } |
427 | 447 |
428 // static | 448 // static |
429 WindowManager* WindowManager::Get() { | 449 WindowManager* WindowManager::Get() { |
430 DCHECK(instance); | 450 DCHECK(instance); |
431 return instance; | 451 return instance; |
432 } | 452 } |
433 | 453 |
434 } // namespace athena | 454 } // namespace athena |
OLD | NEW |