Implement some common web contents overrides.

This commit is contained in:
Cheng Zhao 2013-05-15 19:11:30 +08:00
parent 349ed4fd73
commit f477ec09c0
2 changed files with 24 additions and 0 deletions

View file

@ -196,6 +196,24 @@ void NativeWindow::BeforeUnloadFired(content::WebContents* tab,
WindowList::WindowCloseCancelled(this);
}
void NativeWindow::RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) {
GetWebContents()->GotResponseToLockMouseRequest(true);
}
bool NativeWindow::CanOverscrollContent() const {
return false;
}
void NativeWindow::ActivateContents(content::WebContents* contents) {
GetWebContents()->GetRenderViewHost()->Focus();
}
void NativeWindow::DeactivateContents(content::WebContents* contents) {
GetWebContents()->GetRenderViewHost()->Blur();
}
void NativeWindow::MoveContents(content::WebContents* source,
const gfx::Rect& pos) {
SetPosition(pos.origin());

View file

@ -131,6 +131,12 @@ class NativeWindow : public content::WebContentsDelegate,
virtual void BeforeUnloadFired(content::WebContents* tab,
bool proceed,
bool* proceed_to_fire_unload) OVERRIDE;
virtual void RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) OVERRIDE;
virtual bool CanOverscrollContent() const OVERRIDE;
virtual void ActivateContents(content::WebContents* contents) OVERRIDE;
virtual void DeactivateContents(content::WebContents* contents) OVERRIDE;
virtual void MoveContents(content::WebContents* source,
const gfx::Rect& pos) OVERRIDE;
virtual void CloseContents(content::WebContents* source) OVERRIDE;