| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/wm/dock/docked_window_layout_manager.h" | 5 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/animation/animation_change_type.h" | 7 #include "ash/animation/animation_change_type.h" |
| 8 #include "ash/common/shelf/shelf_background_animator.h" | 8 #include "ash/common/shelf/shelf_background_animator.h" |
| 9 #include "ash/common/shelf/shelf_background_animator_observer.h" | 9 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN), | 375 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN), |
| 376 docked_width_(0), | 376 docked_width_(0), |
| 377 in_overview_(false), | 377 in_overview_(false), |
| 378 alignment_(DOCKED_ALIGNMENT_NONE), | 378 alignment_(DOCKED_ALIGNMENT_NONE), |
| 379 preferred_alignment_(DOCKED_ALIGNMENT_NONE), | 379 preferred_alignment_(DOCKED_ALIGNMENT_NONE), |
| 380 event_source_(DOCKED_ACTION_SOURCE_UNKNOWN), | 380 event_source_(DOCKED_ACTION_SOURCE_UNKNOWN), |
| 381 last_active_window_(nullptr), | 381 last_active_window_(nullptr), |
| 382 last_action_time_(base::Time::Now()), | 382 last_action_time_(base::Time::Now()), |
| 383 background_widget_(nullptr) { | 383 background_widget_(nullptr) { |
| 384 DCHECK(dock_container); | 384 DCHECK(dock_container); |
| 385 dock_container_->GetShell()->AddShellObserver(this); | 385 Shell::GetInstance()->AddShellObserver(this); |
| 386 Shell::GetInstance()->activation_client()->AddObserver(this); | 386 Shell::GetInstance()->activation_client()->AddObserver(this); |
| 387 display::Screen::GetScreen()->AddObserver(this); | 387 display::Screen::GetScreen()->AddObserver(this); |
| 388 } | 388 } |
| 389 | 389 |
| 390 DockedWindowLayoutManager::~DockedWindowLayoutManager() { | 390 DockedWindowLayoutManager::~DockedWindowLayoutManager() { |
| 391 Shutdown(); | 391 Shutdown(); |
| 392 } | 392 } |
| 393 | 393 |
| 394 // static | 394 // static |
| 395 DockedWindowLayoutManager* DockedWindowLayoutManager::Get(WmWindow* window) { | 395 DockedWindowLayoutManager* DockedWindowLayoutManager::Get(WmWindow* window) { |
| 396 if (!window) | 396 if (!window) |
| 397 return nullptr; | 397 return nullptr; |
| 398 | 398 |
| 399 WmWindow* root = window->GetRootWindow(); | 399 WmWindow* root = window->GetRootWindow(); |
| 400 return static_cast<DockedWindowLayoutManager*>( | 400 return static_cast<DockedWindowLayoutManager*>( |
| 401 root->GetChildByShellWindowId(kShellWindowId_DockedContainer) | 401 root->GetChildByShellWindowId(kShellWindowId_DockedContainer) |
| 402 ->GetLayoutManager()); | 402 ->GetLayoutManager()); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void DockedWindowLayoutManager::Shutdown() { | 405 void DockedWindowLayoutManager::Shutdown() { |
| 406 background_widget_.reset(); | 406 background_widget_.reset(); |
| 407 shelf_observer_.reset(); | 407 shelf_observer_.reset(); |
| 408 shelf_ = nullptr; | 408 shelf_ = nullptr; |
| 409 for (WmWindow* child : dock_container_->GetChildren()) { | 409 for (WmWindow* child : dock_container_->GetChildren()) { |
| 410 child->aura_window()->RemoveObserver(this); | 410 child->aura_window()->RemoveObserver(this); |
| 411 child->GetWindowState()->RemoveObserver(this); | 411 child->GetWindowState()->RemoveObserver(this); |
| 412 } | 412 } |
| 413 Shell::GetInstance()->activation_client()->RemoveObserver(this); | 413 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 414 dock_container_->GetShell()->RemoveShellObserver(this); | 414 Shell::GetInstance()->RemoveShellObserver(this); |
| 415 display::Screen::GetScreen()->RemoveObserver(this); | 415 display::Screen::GetScreen()->RemoveObserver(this); |
| 416 } | 416 } |
| 417 | 417 |
| 418 void DockedWindowLayoutManager::AddObserver( | 418 void DockedWindowLayoutManager::AddObserver( |
| 419 DockedWindowLayoutManagerObserver* observer) { | 419 DockedWindowLayoutManagerObserver* observer) { |
| 420 observer_list_.AddObserver(observer); | 420 observer_list_.AddObserver(observer); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void DockedWindowLayoutManager::RemoveObserver( | 423 void DockedWindowLayoutManager::RemoveObserver( |
| 424 DockedWindowLayoutManagerObserver* observer) { | 424 DockedWindowLayoutManagerObserver* observer) { |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 const gfx::Rect& keyboard_bounds) { | 1332 const gfx::Rect& keyboard_bounds) { |
| 1333 // This bounds change will have caused a change to the Shelf which does not | 1333 // This bounds change will have caused a change to the Shelf which does not |
| 1334 // propagate automatically to this class, so manually recalculate bounds. | 1334 // propagate automatically to this class, so manually recalculate bounds. |
| 1335 Relayout(); | 1335 Relayout(); |
| 1336 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1336 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 void DockedWindowLayoutManager::OnKeyboardClosed() {} | 1339 void DockedWindowLayoutManager::OnKeyboardClosed() {} |
| 1340 | 1340 |
| 1341 } // namespace ash | 1341 } // namespace ash |
| OLD | NEW |