Implement window.moveTo and window.ResizeTo. Fix #2.

This commit is contained in:
Cheng Zhao 2013-05-15 13:56:25 +08:00
parent bfea9775a0
commit 349ed4fd73
2 changed files with 15 additions and 0 deletions

View file

@ -196,6 +196,12 @@ void NativeWindow::BeforeUnloadFired(content::WebContents* tab,
WindowList::WindowCloseCancelled(this);
}
void NativeWindow::MoveContents(content::WebContents* source,
const gfx::Rect& pos) {
SetPosition(pos.origin());
SetSize(pos.size());
}
void NativeWindow::CloseContents(content::WebContents* source) {
// When the web contents is gone, close the window immediately, but the
// memory will not be freed until you call delete.
@ -207,6 +213,11 @@ void NativeWindow::CloseContents(content::WebContents* source) {
NotifyWindowClosed();
}
bool NativeWindow::IsPopupOrPanel(const content::WebContents* source) const {
// Only popup window can use things like window.moveTo.
return true;
}
bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(NativeWindow, message)