remote_callback_freer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) 2016 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_COMMON_API_REMOTE_CALLBACK_FREER_H_
  5. #define ATOM_COMMON_API_REMOTE_CALLBACK_FREER_H_
  6. #include "atom/common/api/object_life_monitor.h"
  7. #include "content/public/browser/web_contents_observer.h"
  8. namespace atom {
  9. class RemoteCallbackFreer : public ObjectLifeMonitor,
  10. public content::WebContentsObserver {
  11. public:
  12. static void BindTo(v8::Isolate* isolate,
  13. v8::Local<v8::Object> target,
  14. int object_id,
  15. content::WebContents* web_conents);
  16. protected:
  17. RemoteCallbackFreer(v8::Isolate* isolate,
  18. v8::Local<v8::Object> target,
  19. int object_id,
  20. content::WebContents* web_conents);
  21. ~RemoteCallbackFreer() override;
  22. void RunDestructor() override;
  23. // content::WebContentsObserver:
  24. void RenderViewDeleted(content::RenderViewHost*) override;
  25. private:
  26. int object_id_;
  27. DISALLOW_COPY_AND_ASSIGN(RemoteCallbackFreer);
  28. };
  29. } // namespace atom
  30. #endif // ATOM_COMMON_API_REMOTE_CALLBACK_FREER_H_