| Index: chromecast/graphics/cast_focus_client_aura.h
|
| diff --git a/chromecast/graphics/cast_focus_client_aura.h b/chromecast/graphics/cast_focus_client_aura.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..908ffcf0cc49f5914dc63d0efa3176dd5b056197
|
| --- /dev/null
|
| +++ b/chromecast/graphics/cast_focus_client_aura.h
|
| @@ -0,0 +1,65 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROMECAST_GRAPHICS_CAST_FOCUS_CLIENT_AURA_H_
|
| +#define CHROMECAST_GRAPHICS_CAST_FOCUS_CLIENT_AURA_H_
|
| +
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/observer_list.h"
|
| +#include "ui/aura/client/focus_change_observer.h"
|
| +#include "ui/aura/client/focus_client.h"
|
| +#include "ui/aura/window_observer.h"
|
| +
|
| +namespace aura {
|
| +class Window;
|
| +}
|
| +
|
| +namespace chromecast {
|
| +
|
| +class CastFocusClientAura : public aura::WindowObserver,
|
| + public aura::client::FocusClient {
|
| + public:
|
| + CastFocusClientAura();
|
| + ~CastFocusClientAura() override;
|
| +
|
| + // aura::client::FocusClient implementation:
|
| + void AddObserver(aura::client::FocusChangeObserver* observer) override;
|
| + void RemoveObserver(aura::client::FocusChangeObserver* observer) override;
|
| + void FocusWindow(aura::Window* window) override;
|
| + void ResetFocusWithinActiveWindow(aura::Window* window) override;
|
| + aura::Window* GetFocusedWindow() override;
|
| +
|
| + private:
|
| + // aura::WindowObserver implementation:
|
| + void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
|
| + void OnWindowDestroying(aura::Window* window) override;
|
| + void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override;
|
| +
|
| + // Change the focused window and notify focus observers.
|
| + void UpdateWindowFocus();
|
| + // Get the window that should be focused.
|
| + aura::Window* GetWindowToFocus();
|
| + // Get the top-most window in a window's hierarchy to determine z order.
|
| + // This is the window directly under the root window (a child window of the
|
| + // root window).
|
| + aura::Window* GetZOrderWindow(aura::Window* window);
|
| +
|
| + base::ObserverList<aura::client::FocusChangeObserver> focus_observers_;
|
| +
|
| + // Track the currently focused window, which isn't necessarily a top-level
|
| + // window.
|
| + aura::Window* focused_window_;
|
| + // Track the windows that we've focused in the past, so that we can restore
|
| + // focus to them. We assume that this is a small list so that we can perform
|
| + // linear ops on it.
|
| + std::vector<aura::Window*> focusable_windows_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(CastFocusClientAura);
|
| +};
|
| +
|
| +} // namespace chromecast
|
| +
|
| +#endif // CHROMECAST_GRAPHICS_CAST_FOCUS_CLIENT_AURA_H_
|
|
|