OLD | NEW |
---|---|
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 Loading... | |
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, | |
193 // https://goo.gl/4tJ32G. | |
194 // This behavior is different on Mac OS, which has a unique user-initiated | |
msw
2017/04/04 19:32:48
nit: move this comment into the OS_MACOSX block, c
msw
2017/04/04 19:33:27
Ignore this, sorry.
Hzj_jie
2017/04/04 20:54:43
I think this comment is still relevant. I moved th
| |
195 // full-screen mode. According to the discussion in http://crbug.com/702251, | |
196 // the shortcuts will be reserved once the tab strip / Chrome toolbar is | |
197 // visible. | |
198 const bool is_exit_fullscreen = | |
199 (command_id == IDC_EXIT || command_id == IDC_FULLSCREEN); | |
200 #if defined(OS_MACOSX) | |
201 if (window()->IsToolbarVisible()) { | |
dominickn
2017/03/28 02:01:38
I'm not sure this works correctly on on Mac, where
Hzj_jie
2017/03/29 00:47:54
Thank you Dominick. Unfortunately, I do not even h
| |
202 if (command_id == IDC_FULLSCREEN) | |
msw
2017/04/04 19:32:48
Why not handle IDC_EXIT here?
msw
2017/04/04 19:33:27
Ignore this, sorry.
Hzj_jie
2017/04/04 20:54:43
I think this is by-design. The IDC_EXIT is covered
| |
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 Loading... | |
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 |
OLD | NEW |