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

Unified Diff: third_party/WebKit/Source/core/page/FocusChangedObserver.cpp

Issue 2668003003: Provide WebVR pose data only to the focused frame. (Closed)
Patch Set: Address comments 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
Index: third_party/WebKit/Source/core/page/FocusChangedObserver.cpp
diff --git a/third_party/WebKit/Source/core/page/FocusChangedObserver.cpp b/third_party/WebKit/Source/core/page/FocusChangedObserver.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9e4b0dba135c301afab973ff46239606b2f444d6
--- /dev/null
+++ b/third_party/WebKit/Source/core/page/FocusChangedObserver.cpp
@@ -0,0 +1,27 @@
+// 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.
+
+#include "core/page/FocusChangedObserver.h"
+
+#include "core/page/FocusController.h"
+#include "core/page/Page.h"
+
+namespace blink {
+
+FocusChangedObserver::FocusChangedObserver(Page* page) {
+ DCHECK(page);
+ page->focusController().registerFocusChangedObserver(this);
+}
+
+bool FocusChangedObserver::isFrameFocused(LocalFrame* frame) {
+ if (!frame)
+ return false;
+ Page* page = frame->page();
+ if (!page)
+ return false;
+ const FocusController& controller = page->focusController();
+ return controller.isFocused() && (controller.focusedFrame() == frame);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/page/FocusChangedObserver.h ('k') | third_party/WebKit/Source/core/page/FocusController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698