blob: f585ca974fb3c2ae5038ecc2f3f88e362c97f718 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_WM_PUBLIC_ACTIVATION_CHANGE_OBSERVER_H_
#define UI_WM_PUBLIC_ACTIVATION_CHANGE_OBSERVER_H_
#include "base/observer_list_types.h"
#include "ui/wm/public/wm_public_export.h"
namespace aura {
class Window;
}
namespace wm {
class WM_PUBLIC_EXPORT ActivationChangeObserver : public base::CheckedObserver {
public:
// 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.
ACTIVATION_CLIENT,
// When a user clicks or taps a window in the 2-dimensional screen space or
// when a user moves a mouse over a window while focus follows cursor is
// enabled.
INPUT_EVENT,
// When a new window is activated as a side effect of a window
// disposition changing.
WINDOW_DISPOSITION_CHANGED,
};
// Called when |gaining_active| will gain activation, or there is no active
// window (|gaining_active| is NULL in this case.) |losing_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 OnWindowActivating(ActivationReason reason,
aura::Window* gaining_active,
aura::Window* losing_active) {}
// Called when |gained_active| gains activation, 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,
aura::Window* gained_active,
aura::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) {}
~ActivationChangeObserver() override;
};
// Gets/Sets the ActivationChangeObserver for a specific window. This observer
// is notified after the ActivationClient notifies all registered observers.
WM_PUBLIC_EXPORT void SetActivationChangeObserver(
aura::Window* window,
ActivationChangeObserver* observer);
WM_PUBLIC_EXPORT ActivationChangeObserver* GetActivationChangeObserver(
aura::Window* window);
} // namespace wm
#endif // UI_WM_PUBLIC_ACTIVATION_CHANGE_OBSERVER_H_
|