blob: cd07058aeda2b8f66369b39329911ac11ab07ca7 [file] [log] [blame]
// 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 <map>
#include <memory>
#include "ash/ash_export.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "ui/aura/window_observer.h"
namespace aura {
class Window;
namespace ash {
class ResizeShadow;
// ResizeShadowController observes changes to resizable windows and shows
// a resize handle visual effect when the cursor is near the edges.
class ASH_EXPORT ResizeShadowController : public aura::WindowObserver {
~ResizeShadowController() override;
// Shows the appropriate shadow for a given |window| and |hit_test| location.
void ShowShadow(aura::Window* window, int hit_test);
// Hides the shadow for a |window|, if it has one.
void HideShadow(aura::Window* window);
ResizeShadow* GetShadowForWindowForTest(aura::Window* window);
// aura::WindowObserver overrides:
void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
void OnWindowDestroyed(aura::Window* window) override;
// Creates a shadow for a given window and returns it. |window_shadows_|
// owns the memory.
ResizeShadow* CreateShadow(aura::Window* window);
// Returns the resize shadow for |window| or NULL if no shadow exists.
ResizeShadow* GetShadowForWindow(aura::Window* window);
std::map<aura::Window*, std::unique_ptr<ResizeShadow>> window_shadows_;
} // namespace ash