Commit 93c712cc authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Make blink::PopupOpeningObserver a GarbageCollectedMixin

All of PopupOpeningObserver implementors are on GC heap, and having
raw pointers to them is dangerous.

This CL is a preparation to make blink::FileInputType a
PopupOpeningObserver.

Bug: 637639
Change-Id: Iee014462716cc3c3de91ddf365ab8644e2de5f2e
Reviewed-on: https://chromium-review.googlesource.com/1113084
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569983}
parent 99a2c2bc
......@@ -36,6 +36,8 @@ namespace blink {
class CORE_EXPORT SpinButtonElement final : public HTMLDivElement,
public PopupOpeningObserver {
USING_GARBAGE_COLLECTED_MIXIN(SpinButtonElement);
public:
enum UpDownState {
kIndeterminate, // Hovered, but the event is not handled.
......
......@@ -159,6 +159,11 @@ ChromeClientImpl* ChromeClientImpl::Create(WebViewImpl* web_view) {
return new ChromeClientImpl(web_view);
}
void ChromeClientImpl::Trace(Visitor* visitor) {
visitor->Trace(popup_opening_observers_);
ChromeClient::Trace(visitor);
}
WebViewImpl* ChromeClientImpl::GetWebView() const {
return web_view_;
}
......@@ -1097,8 +1102,9 @@ void ChromeClientImpl::UnregisterPopupOpeningObserver(
}
void ChromeClientImpl::NotifyPopupOpeningObservers() const {
const Vector<PopupOpeningObserver*> observers(popup_opening_observers_);
for (auto* const observer : observers)
const HeapVector<Member<PopupOpeningObserver>> observers(
popup_opening_observers_);
for (const auto& observer : observers)
observer->WillOpenPopup();
}
......
......@@ -52,6 +52,7 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient {
public:
static ChromeClientImpl* Create(WebViewImpl*);
~ChromeClientImpl() override;
void Trace(Visitor* visitor) override;
WebViewImpl* GetWebView() const override;
......@@ -243,7 +244,7 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient {
WebAutofillClient* AutofillClientFromFrame(LocalFrame*);
WebViewImpl* web_view_; // Weak pointer.
Vector<PopupOpeningObserver*> popup_opening_observers_;
HeapVector<Member<PopupOpeningObserver>> popup_opening_observers_;
Cursor last_set_mouse_cursor_for_testing_;
bool cursor_overridden_;
bool did_request_non_empty_tool_tip_;
......
......@@ -27,10 +27,11 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_POPUP_OPENING_OBSERVER_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
namespace blink {
class CORE_EXPORT PopupOpeningObserver {
class CORE_EXPORT PopupOpeningObserver : public GarbageCollectedMixin {
public:
virtual void WillOpenPopup() = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment