From: Cheng Zhao Date: Wed, 15 May 2013 11:11:30 +0000 (+0800) Subject: Implement some common web contents overrides. X-Git-Tag: v0.1.0~171 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=f477ec09c042301457c02e047664344cb55b2883;p=electron.git Implement some common web contents overrides. --- diff --git a/browser/native_window.cc b/browser/native_window.cc index 5542863b..a4effd97 100644 --- a/browser/native_window.cc +++ b/browser/native_window.cc @@ -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()); diff --git a/browser/native_window.h b/browser/native_window.h index 72da57c5..d5ba8328 100644 --- a/browser/native_window.h +++ b/browser/native_window.h @@ -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;