Listen to ElementSizeChanged event

This commit is contained in:
Cheng Zhao 2015-05-29 13:47:09 +08:00
parent e4bb456964
commit b5c9fe78f1
9 changed files with 104 additions and 8 deletions

View file

@ -5,17 +5,38 @@
#ifndef ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
#define ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
#include "base/callback.h"
#include "content/public/renderer/browser_plugin_delegate.h"
#include "v8/include/v8.h"
namespace gfx {
class Size;
}
namespace atom {
class GuestViewContainer : public content::BrowserPluginDelegate {
public:
typedef base::Callback<void(const gfx::Size&, const gfx::Size&)>
ResizeCallback;
explicit GuestViewContainer(content::RenderFrame* render_frame);
~GuestViewContainer() override;
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& old_size,
const gfx::Size& new_size) final;
private:
int element_instance_id_;
content::RenderFrame* render_frame_;
ResizeCallback element_resize_callback_;
DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
};