Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / wm / public / activation_change_observer.h
blob57f9d2733bf53d9830df5f409a2234f8f7368b83
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_WM_PUBLIC_ACTIVATION_CHANGE_OBSERVER_H_
6 #define UI_WM_PUBLIC_ACTIVATION_CHANGE_OBSERVER_H_
8 #include "ui/aura/aura_export.h"
10 namespace aura {
11 class Window;
13 namespace client {
15 class AURA_EXPORT ActivationChangeObserver {
16 public:
17 // The reason or cause of a window activation change.
18 enum class ActivationReason {
19 // When a window is activated due to a call to the ActivationClient API.
20 ACTIVATION_CLIENT,
21 // When a user clicks or taps a window in the 2-dimensional screen space.
22 INPUT_EVENT,
23 // When a new window is activated as a side effect of a window
24 // disposition changing.
25 WINDOW_DISPOSITION_CHANGED,
28 // Called when |gained_active| gains focus, or there is no active window
29 // (|gained_active| is NULL in this case.) |lost_active| refers to the
30 // previous active window or NULL if there was no previously active
31 // window. |reason| specifies the cause of the activation change.
32 virtual void OnWindowActivated(ActivationReason reason,
33 Window* gained_active,
34 Window* lost_active) = 0;
36 // Called when during window activation the currently active window is
37 // selected for activation. This can happen when a window requested for
38 // activation cannot be activated because a system modal window is active.
39 virtual void OnAttemptToReactivateWindow(aura::Window* request_active,
40 aura::Window* actual_active) {}
42 protected:
43 virtual ~ActivationChangeObserver() {}
46 // Gets/Sets the ActivationChangeObserver for a specific window. This observer
47 // is notified after the ActivationClient notifies all registered observers.
48 AURA_EXPORT void SetActivationChangeObserver(
49 Window* window,
50 ActivationChangeObserver* observer);
51 AURA_EXPORT ActivationChangeObserver* GetActivationChangeObserver(
52 Window* window);
54 } // namespace client
55 } // namespace aura
57 #endif // UI_WM_PUBLIC_ACTIVATION_CHANGE_OBSERVER_H_