]> khamidou — GitHub mirrors - electron.git/commitdiff
webContents: exit tabbed fullscreen when esc key is pressed
authorRobo <hop2deep@gmail.com>
Tue, 18 Aug 2015 17:02:34 +0000 (22:32 +0530)
committerRobo <hop2deep@gmail.com>
Tue, 25 Aug 2015 04:35:03 +0000 (10:05 +0530)
atom/browser/api/atom_api_web_contents.cc
atom/browser/common_web_contents_delegate.h

index 63707f8dcc2d3a45f0d83298523a14c70ef50bf4..59a50d5656ce96758bef7ea0fc4d368cde7e386e 100644 (file)
@@ -277,7 +277,10 @@ bool WebContents::IsPopupOrPanel(const content::WebContents* source) const {
 void WebContents::HandleKeyboardEvent(
     content::WebContents* source,
     const content::NativeWebKeyboardEvent& event) {
-  if (type_ == BROWSER_WINDOW) {
+  if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen()) {
+    // Escape exits tabbed fullscreen mode.
+    ExitFullscreenModeForTab(source);
+  } else if (type_ == BROWSER_WINDOW) {
     owner_window()->HandleKeyboardEvent(source, event);
   } else if (type_ == WEB_VIEW && guest_delegate_) {
     // Send the unhandled keyboard events back to the embedder.
index e21cd24e91077bb2ddd56f60d98c4e0dd28b271b..495b5501a0d1cebaff926eb313a149d739699310 100644 (file)
@@ -48,6 +48,8 @@ class CommonWebContentsDelegate
 
   NativeWindow* owner_window() const { return owner_window_.get(); }
 
+  bool is_html_fullscreen() const { return html_fullscreen_; }
+
  protected:
   // content::WebContentsDelegate:
   content::WebContents* OpenURLFromTab(