electron/atom/renderer/guest_view_container.h

47 lines
1.2 KiB
C
Raw Normal View History

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.
#ifndef ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
#define ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
2015-05-29 05:47:09 +00:00
#include "base/callback.h"
2015-03-13 23:33:06 +00:00
#include "content/public/renderer/browser_plugin_delegate.h"
2017-01-24 07:45:26 +00:00
#include "content/public/renderer/render_frame.h"
2015-05-29 05:47:09 +00:00
namespace gfx {
class Size;
}
2015-03-13 23:33:06 +00:00
namespace atom {
class GuestViewContainer : public content::BrowserPluginDelegate {
public:
typedef base::Callback<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);
~GuestViewContainer() override;
2015-05-29 05:47:09 +00:00
static GuestViewContainer* FromID(int element_instance_id);
void RegisterElementResizeCallback(const ResizeCallback& callback);
// content::BrowserPluginDelegate:
void SetElementInstanceID(int element_instance_id) final;
void DidResizeElement(const gfx::Size& new_size) final;
2015-09-02 07:16:49 +00:00
base::WeakPtr<BrowserPluginDelegate> GetWeakPtr() final;
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_;
2015-09-02 07:16:49 +00:00
base::WeakPtrFactory<GuestViewContainer> weak_ptr_factory_;
2015-03-13 23:33:06 +00:00
DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
};
} // namespace atom
#endif // ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_