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

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: Simplifications and unit tests. 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 void reset();
halliwell 2017/01/24 00:54:46 naming nit: Reset And is it intended as a public A
Joshua LeVasseur 2017/01/24 03:39:50 Fixed, and switched to private.
29
30 // aura::client::FocusClient implementation:
31 void AddObserver(aura::client::FocusChangeObserver* observer) override;
32 void RemoveObserver(aura::client::FocusChangeObserver* observer) override;
33 void FocusWindow(aura::Window* window) override;
34 void ResetFocusWithinActiveWindow(aura::Window* window) override;
35 aura::Window* GetFocusedWindow() override;
36
37 private:
38 // aura::WindowObserver implementation:
39 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
40 void OnWindowDestroying(aura::Window* window) override;
41 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override;
42
43 // Change the focused window and notify focus observers.
44 void UpdateWindowFocus();
45 // Get the window that should be focused.
46 aura::Window* GetWindowToFocus();
47 // Get the top-most window in a window's hierarchy.
48 aura::Window* GetTopLevelWindow(aura::Window* window);
49
50 base::ObserverList<aura::client::FocusChangeObserver> focus_observers_;
51
52 // Track the currently focused window, which isn't necessarily a top-level
53 // window.
54 aura::Window* focused_window_;
55 // Track the windows that we've focused in the past, so that we can restore
56 // focus to them. We assume that this is a small list so that we can perform
57 // linear ops on it.
58 std::vector<aura::Window*> focusable_windows_;
59
60 DISALLOW_COPY_AND_ASSIGN(CastFocusClientAura);
61 };
62
63 } // namespace chromecast
64
65 #endif // CHROMECAST_GRAPHICS_CAST_FOCUS_CLIENT_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698