blob: 57f9d2733bf53d9830df5f409a2234f8f7368b83 [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 "ui/aura/aura_export.h"
namespace aura {
class Window;
namespace client {
class AURA_EXPORT ActivationChangeObserver {
// The reason or cause of a window activation change.
enum class ActivationReason {
// When a window is activated due to a call to the ActivationClient API.
// When a user clicks or taps a window in the 2-dimensional screen space.
// When a new window is activated as a side effect of a window
// disposition changing.
// Called when |gained_active| gains focus, or there is no active window
// (|gained_active| is NULL in this case.) |lost_active| refers to the
// previous active window or NULL if there was no previously active
// window. |reason| specifies the cause of the activation change.
virtual void OnWindowActivated(ActivationReason reason,
Window* gained_active,
Window* lost_active) = 0;
// Called when during window activation the currently active window is
// selected for activation. This can happen when a window requested for
// activation cannot be activated because a system modal window is active.
virtual void OnAttemptToReactivateWindow(aura::Window* request_active,
aura::Window* actual_active) {}
virtual ~ActivationChangeObserver() {}
// Gets/Sets the ActivationChangeObserver for a specific window. This observer
// is notified after the ActivationClient notifies all registered observers.
AURA_EXPORT void SetActivationChangeObserver(
Window* window,
ActivationChangeObserver* observer);
AURA_EXPORT ActivationChangeObserver* GetActivationChangeObserver(
Window* window);
} // namespace client
} // namespace aura