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

Unified Diff: headless/lib/browser/headless_focus_client.h

Issue 2709433002: Add HeadlessFocusClient to fix document.hasFocus() issues. (Closed)
Patch Set: Remove unnecessary imports 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/browser/headless_browser_impl_aura.cc ('k') | headless/lib/browser/headless_focus_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_focus_client.h
diff --git a/headless/lib/browser/headless_focus_client.h b/headless/lib/browser/headless_focus_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..a218089ec7de82c359c811e1f0ea38b78c07ca96
--- /dev/null
+++ b/headless/lib/browser/headless_focus_client.h
@@ -0,0 +1,42 @@
+// 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 HEADLESS_LIB_BROWSER_HEADLESS_FOCUS_CLIENT_H_
+#define HEADLESS_LIB_BROWSER_HEADLESS_FOCUS_CLIENT_H_
+
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "base/scoped_observer.h"
+#include "ui/aura/client/focus_client.h"
+#include "ui/aura/window_observer.h"
+
+namespace headless {
+
+class HeadlessFocusClient : public aura::client::FocusClient,
+ public aura::WindowObserver {
+ public:
+ HeadlessFocusClient();
+ ~HeadlessFocusClient() override;
+
+ private:
+ // Overridden from aura::client::FocusClient:
+ 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;
+
+ // Overridden from aura::WindowObserver:
+ void OnWindowDestroying(aura::Window* window) override;
+
+ aura::Window* focused_window_;
+ ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_;
+ base::ObserverList<aura::client::FocusChangeObserver> focus_observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(HeadlessFocusClient);
+};
+
+} // namespace headless
+
+#endif // HEADLESS_LIB_BROWSER_HEADLESS_FOCUS_CLIENT_H_
« no previous file with comments | « headless/lib/browser/headless_browser_impl_aura.cc ('k') | headless/lib/browser/headless_focus_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698