2015-03-13 23:33:06 +00: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.
|
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#ifndef SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|
|
|
|
#define SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|
2015-03-13 23:33:06 +00:00
|
|
|
|
2015-05-29 05:47:09 +00:00
|
|
|
#include "base/callback.h"
|
2021-07-02 00:51:37 +00:00
|
|
|
|
|
|
|
namespace content {
|
|
|
|
class RenderFrame;
|
|
|
|
}
|
2015-05-29 05:47:09 +00:00
|
|
|
|
|
|
|
namespace gfx {
|
|
|
|
class Size;
|
|
|
|
}
|
2015-03-13 23:33:06 +00:00
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2015-03-13 23:33:06 +00:00
|
|
|
|
2020-10-16 01:30:41 +00:00
|
|
|
class GuestViewContainer {
|
2015-03-13 23:33:06 +00:00
|
|
|
public:
|
2021-05-06 22:01:04 +00:00
|
|
|
typedef base::RepeatingCallback<void(const gfx::Size&)> ResizeCallback;
|
2015-05-29 05:47:09 +00:00
|
|
|
|
2015-03-13 23:33:06 +00:00
|
|
|
explicit GuestViewContainer(content::RenderFrame* render_frame);
|
2020-10-16 01:30:41 +00:00
|
|
|
virtual ~GuestViewContainer();
|
2015-03-13 23:33:06 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
GuestViewContainer(const GuestViewContainer&) = delete;
|
|
|
|
GuestViewContainer& operator=(const GuestViewContainer&) = delete;
|
|
|
|
|
2015-05-29 05:47:09 +00:00
|
|
|
static GuestViewContainer* FromID(int element_instance_id);
|
|
|
|
|
|
|
|
void RegisterElementResizeCallback(const ResizeCallback& callback);
|
2020-10-16 01:30:41 +00:00
|
|
|
void SetElementInstanceID(int element_instance_id);
|
|
|
|
void DidResizeElement(const gfx::Size& new_size);
|
2015-05-29 05:47:09 +00:00
|
|
|
|
2015-03-13 23:33:06 +00:00
|
|
|
private:
|
2015-05-29 05:47:09 +00:00
|
|
|
int element_instance_id_;
|
|
|
|
|
|
|
|
ResizeCallback element_resize_callback_;
|
|
|
|
|
2021-01-26 18:16:21 +00:00
|
|
|
base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_{this};
|
2015-03-13 23:33:06 +00:00
|
|
|
};
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|
2015-03-13 23:33:06 +00:00
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#endif // SHELL_RENDERER_GUEST_VIEW_CONTAINER_H_
|