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

Side by Side Diff: ui/aura/mus/focus_synchronizer.h

Issue 2488723002: Reland of Improves focus/activation for aura-mus and DesktopNativeWidgetAura (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/aura/env_observer.h ('k') | ui/aura/mus/focus_synchronizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #ifndef UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_
6 #define UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_
7
8 #include "base/macros.h"
9 #include "ui/aura/client/focus_change_observer.h"
10 #include "ui/aura/env_observer.h"
11
12 namespace ui {
13 namespace mojom {
14 class WindowTree;
15 }
16 }
17
18 namespace aura {
19
20 class FocusSynchronizerDelegate;
21 class WindowMus;
22
23 namespace client {
24 class FocusClient;
25 }
26
27 // FocusSynchronizer is resonsible for keeping focus in sync between aura
28 // and the mus server.
29 class FocusSynchronizer : public client::FocusChangeObserver,
30 public EnvObserver {
31 public:
32 FocusSynchronizer(FocusSynchronizerDelegate* delegate,
33 ui::mojom::WindowTree* window_tree);
34 ~FocusSynchronizer() override;
35
36 // Called when the server side wants to change focus to |window|.
37 void SetFocusFromServer(WindowMus* window);
38
39 // Called when the focused window is destroyed.
40 void OnFocusedWindowDestroyed();
41
42 WindowMus* focused_window() { return focused_window_; }
43
44 private:
45 void SetActiveFocusClient(client::FocusClient* focus_client);
46
47 // Called internally to set |focused_window_| and update the server.
48 void SetFocusedWindow(WindowMus* window);
49
50 // Overriden from client::FocusChangeObserver:
51 void OnWindowFocused(Window* gained_focus, Window* lost_focus) override;
52
53 // Overrided from EnvObserver:
54 void OnWindowInitialized(Window* window) override;
55 void OnActiveFocusClientChanged(client::FocusClient* focus_client,
56 Window* window) override;
57
58 FocusSynchronizerDelegate* delegate_;
59 ui::mojom::WindowTree* window_tree_;
60
61 client::FocusClient* active_focus_client_ = nullptr;
62
63 bool setting_focus_ = false;
64 WindowMus* window_setting_focus_to_ = nullptr;
65 WindowMus* focused_window_ = nullptr;
66
67 DISALLOW_COPY_AND_ASSIGN(FocusSynchronizer);
68 };
69
70 } // namespace aura
71
72 #endif // UI_AURA_MUS_FOCUS_SYNCHRONIZER_H_
OLDNEW
« no previous file with comments | « ui/aura/env_observer.h ('k') | ui/aura/mus/focus_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698