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 2604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2615 if (command_updater_.SupportsCommand(id) && | 2615 if (command_updater_.SupportsCommand(id) && |
2616 command_updater_.IsCommandEnabled(id)) { | 2616 command_updater_.IsCommandEnabled(id)) { |
2617 ExecuteCommand(id); | 2617 ExecuteCommand(id); |
2618 return true; | 2618 return true; |
2619 } | 2619 } |
2620 return false; | 2620 return false; |
2621 } | 2621 } |
2622 | 2622 |
2623 bool Browser::IsReservedCommandOrKey(int command_id, | 2623 bool Browser::IsReservedCommandOrKey(int command_id, |
2624 const NativeWebKeyboardEvent& event) { | 2624 const NativeWebKeyboardEvent& event) { |
| 2625 // In Apps mode, no keys are reserved. |
| 2626 if (is_app()) |
| 2627 return false; |
| 2628 |
2625 #if defined(OS_CHROMEOS) | 2629 #if defined(OS_CHROMEOS) |
2626 // Chrome OS's top row of keys produces F1-10. Make sure that web pages | 2630 // Chrome OS's top row of keys produces F1-10. Make sure that web pages |
2627 // aren't able to block Chrome from performing the standard actions for F1-F4 | 2631 // aren't able to block Chrome from performing the standard actions for F1-F4. |
2628 // (F5-7 are grabbed by other X clients and hence don't need this protection, | 2632 // We should not handle F5-10 here since they are processed by Ash. See also: |
2629 // and F8-10 are handled separately in Chrome via a GDK event filter, but | 2633 // crbug.com/127333#c8 |
2630 // let's future-proof this). | |
2631 ui::KeyboardCode key_code = | 2634 ui::KeyboardCode key_code = |
2632 static_cast<ui::KeyboardCode>(event.windowsKeyCode); | 2635 static_cast<ui::KeyboardCode>(event.windowsKeyCode); |
2633 if (key_code == ui::VKEY_F1 || | 2636 if (key_code == ui::VKEY_F1 || |
2634 key_code == ui::VKEY_F2 || | 2637 key_code == ui::VKEY_F2 || |
2635 key_code == ui::VKEY_F3 || | 2638 key_code == ui::VKEY_F3 || |
2636 key_code == ui::VKEY_F4 || | 2639 key_code == ui::VKEY_F4) { |
2637 key_code == ui::VKEY_F5 || | |
2638 key_code == ui::VKEY_F6 || | |
2639 key_code == ui::VKEY_F7 || | |
2640 key_code == ui::VKEY_F8 || | |
2641 key_code == ui::VKEY_F9 || | |
2642 key_code == ui::VKEY_F10) { | |
2643 return true; | 2640 return true; |
2644 } | 2641 } |
2645 #endif | 2642 #endif |
2646 | 2643 |
2647 // In Apps mode, no keys are reserved. | |
2648 if (is_app()) | |
2649 return false; | |
2650 | |
2651 if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) | 2644 if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) |
2652 return true; | 2645 return true; |
2653 return command_id == IDC_CLOSE_TAB || | 2646 return command_id == IDC_CLOSE_TAB || |
2654 command_id == IDC_CLOSE_WINDOW || | 2647 command_id == IDC_CLOSE_WINDOW || |
2655 command_id == IDC_NEW_INCOGNITO_WINDOW || | 2648 command_id == IDC_NEW_INCOGNITO_WINDOW || |
2656 command_id == IDC_NEW_TAB || | 2649 command_id == IDC_NEW_TAB || |
2657 command_id == IDC_NEW_WINDOW || | 2650 command_id == IDC_NEW_WINDOW || |
2658 command_id == IDC_RESTORE_TAB || | 2651 command_id == IDC_RESTORE_TAB || |
2659 command_id == IDC_SELECT_NEXT_TAB || | 2652 command_id == IDC_SELECT_NEXT_TAB || |
2660 command_id == IDC_SELECT_PREVIOUS_TAB || | 2653 command_id == IDC_SELECT_PREVIOUS_TAB || |
(...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5430 if (contents && !allow_js_access) { | 5423 if (contents && !allow_js_access) { |
5431 contents->web_contents()->GetController().LoadURL( | 5424 contents->web_contents()->GetController().LoadURL( |
5432 target_url, | 5425 target_url, |
5433 content::Referrer(), | 5426 content::Referrer(), |
5434 content::PAGE_TRANSITION_LINK, | 5427 content::PAGE_TRANSITION_LINK, |
5435 std::string()); // No extra headers. | 5428 std::string()); // No extra headers. |
5436 } | 5429 } |
5437 | 5430 |
5438 return contents != NULL; | 5431 return contents != NULL; |
5439 } | 5432 } |
OLD | NEW |