| 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
|
|
|