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

Unified Diff: third_party/WebKit/Source/core/page/FocusController.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/FocusController.cpp
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp
index 28897fcea19a17f418c11d41059ae6d187670d50..c75f524ac1ac4de629c2045c739a8667a6e8457c 100644
--- a/third_party/WebKit/Source/core/page/FocusController.cpp
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -54,11 +54,13 @@
#include "core/html/HTMLSlotElement.h"
#include "core/html/TextControlElement.h"
#include "core/input/EventHandler.h"
+#include "core/layout/HitTestResult.h"
#include "core/page/ChromeClient.h"
+#include "core/page/FocusChangedObserver.h"
#include "core/page/FrameTree.h"
#include "core/page/Page.h"
-#include "core/layout/HitTestResult.h"
#include "core/page/SpatialNavigation.h"
+
#include <limits>
namespace blink {
@@ -766,6 +768,8 @@ void FocusController::setFocusedFrame(Frame* frame, bool notifyEmbedder) {
// part of dispatching the focus event above. See https://crbug.com/570874.
if (m_focusedFrame && m_focusedFrame->client() && notifyEmbedder)
m_focusedFrame->client()->frameFocused();
+
+ notifyFocusChangedObservers();
}
void FocusController::focusDocumentView(Frame* frame, bool notifyEmbedder) {
@@ -868,6 +872,8 @@ void FocusController::setFocused(bool focused) {
dispatchEventsOnWindowAndFocusedElement(
toLocalFrame(m_focusedFrame.get())->document(), focused);
}
+
+ notifyFocusChangedObservers();
}
bool FocusController::setInitialFocus(WebFocusType type) {
@@ -1396,9 +1402,22 @@ bool FocusController::advanceFocusDirectionally(WebFocusType type) {
return consumed;
}
+void FocusController::registerFocusChangedObserver(
+ FocusChangedObserver* observer) {
+ DCHECK(observer);
+ DCHECK(!m_focusChangedObservers.contains(observer));
+ m_focusChangedObservers.insert(observer);
+}
+
+void FocusController::notifyFocusChangedObservers() const {
+ for (const auto& it : m_focusChangedObservers)
+ it->focusedFrameChanged();
+}
+
DEFINE_TRACE(FocusController) {
visitor->trace(m_page);
visitor->trace(m_focusedFrame);
+ visitor->trace(m_focusChangedObservers);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/page/FocusController.h ('k') | third_party/WebKit/Source/modules/vr/NavigatorVR.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698