guest_view_container.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2015 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 SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
  5. #define SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
  6. #include "base/callback.h"
  7. namespace content {
  8. class RenderFrame;
  9. }
  10. namespace gfx {
  11. class Size;
  12. }
  13. namespace electron {
  14. class GuestViewContainer {
  15. public:
  16. typedef base::RepeatingCallback<void(const gfx::Size&)> ResizeCallback;
  17. explicit GuestViewContainer(content::RenderFrame* render_frame);
  18. virtual ~GuestViewContainer();
  19. static GuestViewContainer* FromID(int element_instance_id);
  20. void RegisterElementResizeCallback(const ResizeCallback& callback);
  21. void SetElementInstanceID(int element_instance_id);
  22. void DidResizeElement(const gfx::Size& new_size);
  23. private:
  24. int element_instance_id_;
  25. ResizeCallback element_resize_callback_;
  26. base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_{this};
  27. DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
  28. };
  29. } // namespace electron
  30. #endif // SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_