Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1849)

Unified Diff: ash/common/wm/always_on_top_controller.cc

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/wm/always_on_top_controller.h ('k') | ash/common/wm/container_finder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/always_on_top_controller.cc
diff --git a/ash/common/wm/always_on_top_controller.cc b/ash/common/wm/always_on_top_controller.cc
deleted file mode 100644
index d115f016a653eec0b8dab7a409180d0eb974a50b..0000000000000000000000000000000000000000
--- a/ash/common/wm/always_on_top_controller.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/common/wm/always_on_top_controller.h"
-
-#include "ash/common/wm/workspace/workspace_layout_manager.h"
-#include "ash/common/wm_window.h"
-#include "ash/public/cpp/shell_window_ids.h"
-#include "base/memory/ptr_util.h"
-#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/window.h"
-
-namespace ash {
-
-AlwaysOnTopController::AlwaysOnTopController(WmWindow* viewport)
- : always_on_top_container_(viewport) {
- DCHECK_NE(kShellWindowId_DefaultContainer, viewport->GetShellWindowId());
- always_on_top_container_->SetLayoutManager(
- base::MakeUnique<WorkspaceLayoutManager>(viewport));
- // Container should be empty.
- DCHECK(always_on_top_container_->GetChildren().empty());
- always_on_top_container_->aura_window()->AddObserver(this);
-}
-
-AlwaysOnTopController::~AlwaysOnTopController() {
- if (always_on_top_container_)
- always_on_top_container_->aura_window()->RemoveObserver(this);
-}
-
-WmWindow* AlwaysOnTopController::GetContainer(WmWindow* window) const {
- DCHECK(always_on_top_container_);
- if (window->aura_window()->GetProperty(aura::client::kAlwaysOnTopKey))
- return always_on_top_container_;
- return always_on_top_container_->GetRootWindow()->GetChildByShellWindowId(
- kShellWindowId_DefaultContainer);
-}
-
-// TODO(rsadam@): Refactor so that this cast is unneeded.
-WorkspaceLayoutManager* AlwaysOnTopController::GetLayoutManager() const {
- return static_cast<WorkspaceLayoutManager*>(
- always_on_top_container_->GetLayoutManager());
-}
-
-void AlwaysOnTopController::SetLayoutManagerForTest(
- std::unique_ptr<WorkspaceLayoutManager> layout_manager) {
- always_on_top_container_->SetLayoutManager(std::move(layout_manager));
-}
-
-void AlwaysOnTopController::OnWindowHierarchyChanged(
- const HierarchyChangeParams& params) {
- if (WmWindow::Get(params.old_parent) == always_on_top_container_)
- params.target->RemoveObserver(this);
- else if (WmWindow::Get(params.new_parent) == always_on_top_container_)
- params.target->AddObserver(this);
-}
-
-void AlwaysOnTopController::OnWindowPropertyChanged(aura::Window* window,
- const void* key,
- intptr_t old) {
- if (WmWindow::Get(window) != always_on_top_container_ &&
- key == aura::client::kAlwaysOnTopKey) {
- DCHECK(window->type() == ui::wm::WINDOW_TYPE_NORMAL ||
- window->type() == ui::wm::WINDOW_TYPE_POPUP);
- WmWindow* container = GetContainer(WmWindow::Get(window));
- if (WmWindow::Get(window->parent()) != container)
- container->AddChild(WmWindow::Get(window));
- }
-}
-
-void AlwaysOnTopController::OnWindowDestroying(aura::Window* window) {
- if (WmWindow::Get(window) == always_on_top_container_) {
- always_on_top_container_->aura_window()->RemoveObserver(this);
- always_on_top_container_ = nullptr;
- }
-}
-
-} // namespace ash
« no previous file with comments | « ash/common/wm/always_on_top_controller.h ('k') | ash/common/wm/container_finder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698