]> khamidou — GitHub mirrors - electron.git/commitdiff
Implement some common web contents overrides.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 15 May 2013 11:11:30 +0000 (19:11 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 15 May 2013 11:11:30 +0000 (19:11 +0800)
browser/native_window.cc
browser/native_window.h

index 5542863bd5aee139a6bb8ab95ce9c112e616d064..a4effd97234bd26f6f899b9f3ebfc6fdec1ca0df 100644 (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());
index 72da57c5896cb77fda9207c68e57e393c2ebec5a..d5ba8328f6df50c770587d5b9e3f6f6c946be339 100644 (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;