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.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 if (is_app()) | 2311 if (is_app()) |
2312 return false; | 2312 return false; |
2313 | 2313 |
2314 #if defined(OS_CHROMEOS) | 2314 #if defined(OS_CHROMEOS) |
2315 // Chrome OS's top row of keys produces F1-10. Make sure that web pages | 2315 // Chrome OS's top row of keys produces F1-10. Make sure that web pages |
2316 // aren't able to block Chrome from performing the standard actions for F1-F4. | 2316 // aren't able to block Chrome from performing the standard actions for F1-F4. |
2317 // We should not handle F5-10 here since they are processed by Ash. See also: | 2317 // We should not handle F5-10 here since they are processed by Ash. See also: |
2318 // crbug.com/127333#c8 | 2318 // crbug.com/127333#c8 |
2319 ui::KeyboardCode key_code = | 2319 ui::KeyboardCode key_code = |
2320 static_cast<ui::KeyboardCode>(event.windowsKeyCode); | 2320 static_cast<ui::KeyboardCode>(event.windowsKeyCode); |
2321 if (key_code == ui::VKEY_F1 || | 2321 if ((key_code == ui::VKEY_F1 || |
2322 key_code == ui::VKEY_F2 || | 2322 key_code == ui::VKEY_F2 || |
2323 key_code == ui::VKEY_F3 || | 2323 key_code == ui::VKEY_F3 || |
2324 key_code == ui::VKEY_F4) { | 2324 key_code == ui::VKEY_F4) && |
| 2325 // Make sure it's a browser shortcut (i.e. not an Ash one like Alt+F4). |
| 2326 command_id != -1) { |
2325 return true; | 2327 return true; |
2326 } | 2328 } |
2327 #endif | 2329 #endif |
2328 | 2330 |
2329 if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) | 2331 if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) |
2330 return true; | 2332 return true; |
2331 return command_id == IDC_CLOSE_TAB || | 2333 return command_id == IDC_CLOSE_TAB || |
2332 command_id == IDC_CLOSE_WINDOW || | 2334 command_id == IDC_CLOSE_WINDOW || |
2333 command_id == IDC_NEW_INCOGNITO_WINDOW || | 2335 command_id == IDC_NEW_INCOGNITO_WINDOW || |
2334 command_id == IDC_NEW_TAB || | 2336 command_id == IDC_NEW_TAB || |
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5109 if (contents && !allow_js_access) { | 5111 if (contents && !allow_js_access) { |
5110 contents->web_contents()->GetController().LoadURL( | 5112 contents->web_contents()->GetController().LoadURL( |
5111 target_url, | 5113 target_url, |
5112 content::Referrer(), | 5114 content::Referrer(), |
5113 content::PAGE_TRANSITION_LINK, | 5115 content::PAGE_TRANSITION_LINK, |
5114 std::string()); // No extra headers. | 5116 std::string()); // No extra headers. |
5115 } | 5117 } |
5116 | 5118 |
5117 return contents != NULL; | 5119 return contents != NULL; |
5118 } | 5120 } |
OLD | NEW |