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

Unified Diff: mash/wm/shadow_controller.cc

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: move comment Created 4 years, 7 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 | « mash/wm/shadow_controller.h ('k') | mash/wm/shelf_layout_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/wm/shadow_controller.cc
diff --git a/mash/wm/shadow_controller.cc b/mash/wm/shadow_controller.cc
deleted file mode 100644
index 280bdaeee2151dc2402cf29cbda91b0a2787da67..0000000000000000000000000000000000000000
--- a/mash/wm/shadow_controller.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2015 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 "mash/wm/shadow_controller.h"
-
-#include "components/mus/public/cpp/window.h"
-#include "components/mus/public/cpp/window_tree_client.h"
-#include "mash/wm/property_util.h"
-#include "mash/wm/shadow.h"
-
-namespace mash {
-namespace wm {
-namespace {
-
-// Returns the first ancestor of |from| (including |from|) that has a shadow.
-mus::Window* FindAncestorWithShadow(mus::Window* from) {
- mus::Window* result = from;
- while (result && !GetShadow(result))
- result = result->parent();
- // Small shadows never change.
- return result && GetShadow(result)->style() != Shadow::STYLE_SMALL ? result
- : nullptr;
-}
-
-} // namespace
-
-ShadowController::ShadowController(mus::WindowTreeClient* window_tree)
- : window_tree_(window_tree), active_window_(nullptr) {
- window_tree_->AddObserver(this);
- SetActiveWindow(FindAncestorWithShadow(window_tree_->GetFocusedWindow()));
-}
-
-ShadowController::~ShadowController() {
- window_tree_->RemoveObserver(this);
- if (active_window_)
- active_window_->RemoveObserver(this);
-}
-
-void ShadowController::SetActiveWindow(mus::Window* window) {
- if (window == active_window_)
- return;
-
- if (active_window_) {
- if (GetShadow(active_window_))
- GetShadow(active_window_)->SetStyle(Shadow::STYLE_INACTIVE);
- active_window_->RemoveObserver(this);
- }
- active_window_ = window;
- if (active_window_) {
- GetShadow(active_window_)->SetStyle(Shadow::STYLE_ACTIVE);
- active_window_->AddObserver(this);
- }
-}
-
-void ShadowController::OnWindowTreeFocusChanged(mus::Window* gained_focus,
- mus::Window* lost_focus) {
- SetActiveWindow(FindAncestorWithShadow(gained_focus));
-}
-
-void ShadowController::OnWindowDestroying(mus::Window* window) {
- DCHECK_EQ(window, active_window_);
- SetActiveWindow(nullptr);
-}
-
-} // namespace wm
-} // namespace mash
« no previous file with comments | « mash/wm/shadow_controller.h ('k') | mash/wm/shelf_layout_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698