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

Unified Diff: ash/mus/shadow_controller.cc

Issue 2690363002: chromeos: removes mash shadows (Closed)
Patch Set: merge 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/mus/shadow_controller.h ('k') | ash/mus/window_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/shadow_controller.cc
diff --git a/ash/mus/shadow_controller.cc b/ash/mus/shadow_controller.cc
deleted file mode 100644
index 605d0bb1a54b40bac21883775c87d40724ac0a3d..0000000000000000000000000000000000000000
--- a/ash/mus/shadow_controller.cc
+++ /dev/null
@@ -1,90 +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 "ash/mus/shadow_controller.h"
-
-#include "ash/mus/shadow.h"
-#include "ui/aura/client/focus_client.h"
-#include "ui/aura/env.h"
-#include "ui/aura/window.h"
-
-namespace ash {
-namespace mus {
-namespace {
-
-// Returns the first ancestor of |from| (including |from|) that has a shadow.
-aura::Window* FindAncestorWithShadow(aura::Window* from) {
- aura::Window* result = from;
- while (result && !Shadow::Get(result))
- result = result->parent();
- // Small shadows never change.
- return result && Shadow::Get(result)->style() != Shadow::STYLE_SMALL
- ? result
- : nullptr;
-}
-
-} // namespace
-
-ShadowController::ShadowController() {
- aura::Env::GetInstance()->AddObserver(this);
- SetFocusClient(aura::Env::GetInstance()->active_focus_client());
-}
-
-ShadowController::~ShadowController() {
- aura::Env::GetInstance()->RemoveObserver(this);
- if (active_window_)
- active_window_->RemoveObserver(this);
- if (active_focus_client_)
- active_focus_client_->RemoveObserver(this);
-}
-
-void ShadowController::SetActiveWindow(aura::Window* window) {
- window = FindAncestorWithShadow(window);
- if (window == active_window_)
- return;
-
- if (active_window_) {
- if (Shadow::Get(active_window_))
- Shadow::Get(active_window_)->SetStyle(Shadow::STYLE_INACTIVE);
- active_window_->RemoveObserver(this);
- }
- active_window_ = window;
- if (active_window_) {
- Shadow::Get(active_window_)->SetStyle(Shadow::STYLE_ACTIVE);
- active_window_->AddObserver(this);
- }
-}
-
-void ShadowController::SetFocusClient(aura::client::FocusClient* focus_client) {
- if (active_focus_client_)
- active_focus_client_->RemoveObserver(this);
- active_focus_client_ = focus_client;
- if (active_focus_client_) {
- active_focus_client_->AddObserver(this);
- SetActiveWindow(active_focus_client_->GetFocusedWindow());
- } else {
- SetActiveWindow(nullptr);
- }
-}
-
-void ShadowController::OnWindowInitialized(aura::Window* window) {}
-
-void ShadowController::OnActiveFocusClientChanged(
- aura::client::FocusClient* focus_client,
- aura::Window* window) {
- SetFocusClient(focus_client);
-}
-
-void ShadowController::OnWindowFocused(aura::Window* gained_focus,
- aura::Window* lost_focus) {
- SetActiveWindow(gained_focus);
-}
-
-void ShadowController::OnWindowDestroying(aura::Window* window) {
- DCHECK_EQ(window, active_window_);
- SetActiveWindow(nullptr);
-}
-
-} // namespace mus
-} // namespace ash
« no previous file with comments | « ash/mus/shadow_controller.h ('k') | ash/mus/window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698