Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: chrome/browser/ui/browser_command_controller.cc

Issue 2781633003: Allow keyboard shortcuts can be captured by webpage when toolbar is not visible (Closed)
Patch Set: Resolve review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // reserve browser back/forward and refresh here. 180 // reserve browser back/forward and refresh here.
181 ui::KeyboardCode key_code = 181 ui::KeyboardCode key_code =
182 static_cast<ui::KeyboardCode>(event.windowsKeyCode); 182 static_cast<ui::KeyboardCode>(event.windowsKeyCode);
183 if ((key_code == ui::VKEY_BROWSER_BACK && command_id == IDC_BACK) || 183 if ((key_code == ui::VKEY_BROWSER_BACK && command_id == IDC_BACK) ||
184 (key_code == ui::VKEY_BROWSER_FORWARD && command_id == IDC_FORWARD) || 184 (key_code == ui::VKEY_BROWSER_FORWARD && command_id == IDC_FORWARD) ||
185 (key_code == ui::VKEY_BROWSER_REFRESH && command_id == IDC_RELOAD)) { 185 (key_code == ui::VKEY_BROWSER_REFRESH && command_id == IDC_RELOAD)) {
186 return true; 186 return true;
187 } 187 }
188 #endif 188 #endif
189 189
190 if (window()->IsFullscreen() && command_id == IDC_FULLSCREEN) 190 if (window()->IsFullscreen()) {
191 return true; 191 // In fullscreen, all commands except for IDC_FULLSCREEN and IDC_EXIT should
192 // be delivered to the web page. See, intent to implement and ship can be
msw 2017/04/05 23:55:10 nit: grammar, consider "The intent to implement an
Hzj_jie 2017/04/06 02:37:58 Done.
193 // found in http://crbug.com/680809.
194 const bool is_exit_fullscreen =
195 (command_id == IDC_EXIT || command_id == IDC_FULLSCREEN);
196 #if defined(OS_MACOSX)
197 // This behavior is different on Mac OS, which has a unique user-initiated
198 // full-screen mode. According to the discussion in http://crbug.com/702251,
199 // the commands should be reserved for browser-side handling if the browser
200 // window's toolbar is visible.
201 if (window()->IsToolbarShowing()) {
202 if (command_id == IDC_FULLSCREEN)
203 return true;
204 } else {
205 return is_exit_fullscreen;
206 }
207 #else
208 return is_exit_fullscreen;
209 #endif
210 }
192 211
193 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 212 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
194 // If this key was registered by the user as a content editing hotkey, then 213 // If this key was registered by the user as a content editing hotkey, then
195 // it is not reserved. 214 // it is not reserved.
196 ui::TextEditKeyBindingsDelegateAuraLinux* delegate = 215 ui::TextEditKeyBindingsDelegateAuraLinux* delegate =
197 ui::GetTextEditKeyBindingsDelegate(); 216 ui::GetTextEditKeyBindingsDelegate();
198 if (delegate && event.os_event && delegate->MatchEvent(*event.os_event, NULL)) 217 if (delegate && event.os_event && delegate->MatchEvent(*event.os_event, NULL))
199 return false; 218 return false;
200 #endif 219 #endif
201 220
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 1163
1145 BrowserWindow* BrowserCommandController::window() { 1164 BrowserWindow* BrowserCommandController::window() {
1146 return browser_->window(); 1165 return browser_->window();
1147 } 1166 }
1148 1167
1149 Profile* BrowserCommandController::profile() { 1168 Profile* BrowserCommandController::profile() {
1150 return browser_->profile(); 1169 return browser_->profile();
1151 } 1170 }
1152 1171
1153 } // namespace chrome 1172 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698