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

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: reviewer feedback Created 3 years, 10 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
« no previous file with comments | « chromecast/graphics/DEPS ('k') | chromecast/graphics/cast_focus_client_aura.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 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 to determine z order.
46 // This is the window directly under the root window (a child window of the
47 // root window).
48 aura::Window* GetZOrderWindow(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
« no previous file with comments | « chromecast/graphics/DEPS ('k') | chromecast/graphics/cast_focus_client_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698