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

Side by Side Diff: chromecast/graphics/cast_focus_client_aura.h

Issue 2636303002: [Chromecast] Add support for z-order and window focus. (Closed)
Patch Set: more tests, and bug fix found by test Created 3 years, 11 months 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
OLDNEW
(Empty)
1 // Copyright 2017 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 CHROMECAST_GRAPHICS_CAST_FOCUS_CLIENT_AURA_H_
6 #define CHROMECAST_GRAPHICS_CAST_FOCUS_CLIENT_AURA_H_
7
8 #include <vector>
9
10 #include "base/macros.h"
11 #include "base/observer_list.h"
12 #include "ui/aura/client/focus_change_observer.h"
13 #include "ui/aura/client/focus_client.h"
14 #include "ui/aura/window_observer.h"
15
16 namespace aura {
17 class Window;
18 }
19
20 namespace chromecast {
21
22 class CastFocusClientAura : public aura::WindowObserver,
23 public aura::client::FocusClient {
24 public:
25 CastFocusClientAura();
26 ~CastFocusClientAura() override;
27
28 // aura::client::FocusClient implementation:
29 void AddObserver(aura::client::FocusChangeObserver* observer) override;
30 void RemoveObserver(aura::client::FocusChangeObserver* observer) override;
31 void FocusWindow(aura::Window* window) override;
32 void ResetFocusWithinActiveWindow(aura::Window* window) override;
33 aura::Window* GetFocusedWindow() override;
34
35 private:
36 // aura::WindowObserver implementation:
37 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
38 void OnWindowDestroying(aura::Window* window) override;
39 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override;
40
41 // Change the focused window and notify focus observers.
42 void UpdateWindowFocus();
43 // Get the window that should be focused.
44 aura::Window* GetWindowToFocus();
45 // Get the top-most window in a window's hierarchy.
46 aura::Window* GetTopLevelWindow(aura::Window* window);
47
48 base::ObserverList<aura::client::FocusChangeObserver> focus_observers_;
49
50 // Track the currently focused window, which isn't necessarily a top-level
51 // window.
52 aura::Window* focused_window_;
53 // Track the windows that we've focused in the past, so that we can restore
54 // focus to them. We assume that this is a small list so that we can perform
55 // linear ops on it.
56 std::vector<aura::Window*> focusable_windows_;
57
58 DISALLOW_COPY_AND_ASSIGN(CastFocusClientAura);
59 };
60
61 } // namespace chromecast
62
63 #endif // CHROMECAST_GRAPHICS_CAST_FOCUS_CLIENT_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698