2016-04-26 07:10:27 +00:00
|
|
|
// Copyright (c) 2016 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-09-18 16:52:06 +00:00
|
|
|
#ifndef SHELL_COMMON_API_REMOTE_REMOTE_CALLBACK_FREER_H_
|
|
|
|
#define SHELL_COMMON_API_REMOTE_REMOTE_CALLBACK_FREER_H_
|
2018-07-10 08:15:40 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2016-04-26 07:10:27 +00:00
|
|
|
#include "content/public/browser/web_contents_observer.h"
|
2020-05-12 16:32:04 +00:00
|
|
|
#include "shell/common/api/object_life_monitor.h"
|
2016-04-26 07:10:27 +00:00
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2016-04-26 07:10:27 +00:00
|
|
|
|
|
|
|
class RemoteCallbackFreer : public ObjectLifeMonitor,
|
|
|
|
public content::WebContentsObserver {
|
|
|
|
public:
|
|
|
|
static void BindTo(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Object> target,
|
2019-10-29 06:40:09 +00:00
|
|
|
int frame_id,
|
2018-07-10 08:15:40 +00:00
|
|
|
const std::string& context_id,
|
2016-04-26 07:10:27 +00:00
|
|
|
int object_id,
|
|
|
|
content::WebContents* web_conents);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
RemoteCallbackFreer(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Object> target,
|
2019-10-29 06:40:09 +00:00
|
|
|
int frame_id,
|
2018-07-10 08:15:40 +00:00
|
|
|
const std::string& context_id,
|
2016-04-26 07:10:27 +00:00
|
|
|
int object_id,
|
|
|
|
content::WebContents* web_conents);
|
|
|
|
~RemoteCallbackFreer() override;
|
|
|
|
|
|
|
|
void RunDestructor() override;
|
|
|
|
|
|
|
|
// content::WebContentsObserver:
|
2016-04-26 07:30:26 +00:00
|
|
|
void RenderViewDeleted(content::RenderViewHost*) override;
|
2016-04-26 07:10:27 +00:00
|
|
|
|
|
|
|
private:
|
2019-10-29 06:40:09 +00:00
|
|
|
int frame_id_;
|
2018-07-10 08:15:40 +00:00
|
|
|
std::string context_id_;
|
2016-04-26 07:10:27 +00:00
|
|
|
int object_id_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(RemoteCallbackFreer);
|
|
|
|
};
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|
2016-04-26 07:10:27 +00:00
|
|
|
|
2019-09-18 16:52:06 +00:00
|
|
|
#endif // SHELL_COMMON_API_REMOTE_REMOTE_CALLBACK_FREER_H_
|