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 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 if (command_updater_.SupportsCommand(id) && | 2656 if (command_updater_.SupportsCommand(id) && |
2657 command_updater_.IsCommandEnabled(id)) { | 2657 command_updater_.IsCommandEnabled(id)) { |
2658 ExecuteCommand(id); | 2658 ExecuteCommand(id); |
2659 return true; | 2659 return true; |
2660 } | 2660 } |
2661 return false; | 2661 return false; |
2662 } | 2662 } |
2663 | 2663 |
2664 bool Browser::IsReservedCommandOrKey(int command_id, | 2664 bool Browser::IsReservedCommandOrKey(int command_id, |
2665 const NativeWebKeyboardEvent& event) { | 2665 const NativeWebKeyboardEvent& event) { |
| 2666 // In Apps mode, no keys are reserved. |
| 2667 if (is_app()) |
| 2668 return false; |
| 2669 |
2666 #if defined(OS_CHROMEOS) | 2670 #if defined(OS_CHROMEOS) |
2667 // Chrome OS's top row of keys produces F1-10. Make sure that web pages | 2671 // Chrome OS's top row of keys produces F1-10. Make sure that web pages |
2668 // aren't able to block Chrome from performing the standard actions for F1-F4 | 2672 // aren't able to block Chrome from performing the standard actions for F1-F4 |
2669 // (F5-7 are grabbed by other X clients and hence don't need this protection, | 2673 // (F5-7 are grabbed by other X clients and hence don't need this protection, |
2670 // and F8-10 are handled separately in Chrome via a GDK event filter, but | 2674 // and F8-10 are handled separately in Chrome via a GDK event filter, but |
2671 // let's future-proof this). | 2675 // let's future-proof this). |
2672 ui::KeyboardCode key_code = | 2676 ui::KeyboardCode key_code = |
2673 static_cast<ui::KeyboardCode>(event.windowsKeyCode); | 2677 static_cast<ui::KeyboardCode>(event.windowsKeyCode); |
2674 if (key_code == ui::VKEY_F1 || | 2678 if (key_code == ui::VKEY_F1 || |
2675 key_code == ui::VKEY_F2 || | 2679 key_code == ui::VKEY_F2 || |
2676 key_code == ui::VKEY_F3 || | 2680 key_code == ui::VKEY_F3 || |
2677 key_code == ui::VKEY_F4 || | 2681 key_code == ui::VKEY_F4 || |
2678 key_code == ui::VKEY_F5 || | 2682 key_code == ui::VKEY_F5 || |
2679 key_code == ui::VKEY_F6 || | 2683 key_code == ui::VKEY_F6 || |
2680 key_code == ui::VKEY_F7 || | 2684 key_code == ui::VKEY_F7 || |
2681 key_code == ui::VKEY_F8 || | 2685 key_code == ui::VKEY_F8 || |
2682 key_code == ui::VKEY_F9 || | 2686 key_code == ui::VKEY_F9 || |
2683 key_code == ui::VKEY_F10) { | 2687 key_code == ui::VKEY_F10) { |
2684 return true; | 2688 return true; |
2685 } | 2689 } |
2686 #endif | 2690 #endif |
2687 | 2691 |
2688 // In Apps mode, no keys are reserved. | |
2689 if (is_app()) | |
2690 return false; | |
2691 | |
2692 if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) | 2692 if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) |
2693 return true; | 2693 return true; |
2694 return command_id == IDC_CLOSE_TAB || | 2694 return command_id == IDC_CLOSE_TAB || |
2695 command_id == IDC_CLOSE_WINDOW || | 2695 command_id == IDC_CLOSE_WINDOW || |
2696 command_id == IDC_NEW_INCOGNITO_WINDOW || | 2696 command_id == IDC_NEW_INCOGNITO_WINDOW || |
2697 command_id == IDC_NEW_TAB || | 2697 command_id == IDC_NEW_TAB || |
2698 command_id == IDC_NEW_WINDOW || | 2698 command_id == IDC_NEW_WINDOW || |
2699 command_id == IDC_RESTORE_TAB || | 2699 command_id == IDC_RESTORE_TAB || |
2700 command_id == IDC_SELECT_NEXT_TAB || | 2700 command_id == IDC_SELECT_NEXT_TAB || |
2701 command_id == IDC_SELECT_PREVIOUS_TAB || | 2701 command_id == IDC_SELECT_PREVIOUS_TAB || |
(...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5507 if (contents && !allow_js_access) { | 5507 if (contents && !allow_js_access) { |
5508 contents->web_contents()->GetController().LoadURL( | 5508 contents->web_contents()->GetController().LoadURL( |
5509 target_url, | 5509 target_url, |
5510 content::Referrer(), | 5510 content::Referrer(), |
5511 content::PAGE_TRANSITION_LINK, | 5511 content::PAGE_TRANSITION_LINK, |
5512 std::string()); // No extra headers. | 5512 std::string()); // No extra headers. |
5513 } | 5513 } |
5514 | 5514 |
5515 return contents != NULL; | 5515 return contents != NULL; |
5516 } | 5516 } |
OLD | NEW |