2015-03-13 16:33:06 -07:00
|
|
|
// Copyright (c) 2015 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#ifndef ELECTRON_SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|
|
|
|
#define ELECTRON_SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|
2015-03-13 16:33:06 -07:00
|
|
|
|
2015-05-29 13:47:09 +08:00
|
|
|
#include "base/callback.h"
|
2021-07-01 17:51:37 -07:00
|
|
|
|
|
|
|
namespace content {
|
|
|
|
class RenderFrame;
|
|
|
|
}
|
2015-05-29 13:47:09 +08:00
|
|
|
|
|
|
|
namespace gfx {
|
|
|
|
class Size;
|
|
|
|
}
|
2015-03-13 16:33:06 -07:00
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
namespace electron {
|
2015-03-13 16:33:06 -07:00
|
|
|
|
2020-10-15 18:30:41 -07:00
|
|
|
class GuestViewContainer {
|
2015-03-13 16:33:06 -07:00
|
|
|
public:
|
2021-05-06 15:01:04 -07:00
|
|
|
typedef base::RepeatingCallback<void(const gfx::Size&)> ResizeCallback;
|
2015-05-29 13:47:09 +08:00
|
|
|
|
2015-03-13 16:33:06 -07:00
|
|
|
explicit GuestViewContainer(content::RenderFrame* render_frame);
|
2020-10-15 18:30:41 -07:00
|
|
|
virtual ~GuestViewContainer();
|
2015-03-13 16:33:06 -07:00
|
|
|
|
2021-11-03 12:41:45 +01:00
|
|
|
// disable copy
|
|
|
|
GuestViewContainer(const GuestViewContainer&) = delete;
|
|
|
|
GuestViewContainer& operator=(const GuestViewContainer&) = delete;
|
|
|
|
|
2015-05-29 13:47:09 +08:00
|
|
|
static GuestViewContainer* FromID(int element_instance_id);
|
|
|
|
|
|
|
|
void RegisterElementResizeCallback(const ResizeCallback& callback);
|
2020-10-15 18:30:41 -07:00
|
|
|
void SetElementInstanceID(int element_instance_id);
|
|
|
|
void DidResizeElement(const gfx::Size& new_size);
|
2015-05-29 13:47:09 +08:00
|
|
|
|
2015-03-13 16:33:06 -07:00
|
|
|
private:
|
2015-05-29 13:47:09 +08:00
|
|
|
int element_instance_id_;
|
|
|
|
|
|
|
|
ResizeCallback element_resize_callback_;
|
|
|
|
|
2021-01-26 19:16:21 +01:00
|
|
|
base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_{this};
|
2015-03-13 16:33:06 -07:00
|
|
|
};
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
} // namespace electron
|
2015-03-13 16:33:06 -07:00
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|