refactor: remove content::WebContentsObserver from Event (#19251)
This commit is contained in:
parent
c71cdce0b7
commit
c76b0b70c1
3 changed files with 6 additions and 43 deletions
|
@ -6,7 +6,6 @@
|
|||
#define SHELL_BROWSER_API_EVENT_H_
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "electron/shell/common/api/api.mojom.h"
|
||||
#include "native_mate/handle.h"
|
||||
#include "native_mate/wrappable.h"
|
||||
|
@ -17,7 +16,7 @@ class Message;
|
|||
|
||||
namespace mate {
|
||||
|
||||
class Event : public Wrappable<Event>, public content::WebContentsObserver {
|
||||
class Event : public Wrappable<Event> {
|
||||
public:
|
||||
using MessageSyncCallback =
|
||||
electron::mojom::ElectronBrowser::MessageSyncCallback;
|
||||
|
@ -26,9 +25,8 @@ class Event : public Wrappable<Event>, public content::WebContentsObserver {
|
|||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
||||
// Pass the sender and message to be replied.
|
||||
void SetSenderAndMessage(content::RenderFrameHost* sender,
|
||||
base::Optional<MessageSyncCallback> callback);
|
||||
// Pass the callback to be invoked.
|
||||
void SetCallback(base::Optional<MessageSyncCallback> callback);
|
||||
|
||||
// event.PreventDefault().
|
||||
void PreventDefault(v8::Isolate* isolate);
|
||||
|
@ -41,15 +39,8 @@ class Event : public Wrappable<Event>, public content::WebContentsObserver {
|
|||
explicit Event(v8::Isolate* isolate);
|
||||
~Event() override;
|
||||
|
||||
// content::WebContentsObserver implementations:
|
||||
void RenderFrameDeleted(content::RenderFrameHost* rfh) override;
|
||||
void RenderFrameHostChanged(content::RenderFrameHost* old_rfh,
|
||||
content::RenderFrameHost* new_rfh) override;
|
||||
void FrameDeleted(content::RenderFrameHost* rfh) override;
|
||||
|
||||
private:
|
||||
// Replyer for the synchronous messages.
|
||||
content::RenderFrameHost* sender_ = nullptr;
|
||||
base::Optional<MessageSyncCallback> callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue