| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/location_bar_view.h" | 5 #include "chrome/browser/views/location_bar_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/favicon_size.h" | 8 #include "app/gfx/favicon_size.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 884 bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { |
| 885 if (keyword_hint_view_.IsVisible() && | 885 if (keyword_hint_view_.IsVisible() && |
| 886 views::FocusManager::IsTabTraversalKeyEvent(e)) { | 886 views::FocusManager::IsTabTraversalKeyEvent(e)) { |
| 887 // We want to receive tab key events when the hint is showing. | 887 // We want to receive tab key events when the hint is showing. |
| 888 return true; | 888 return true; |
| 889 } | 889 } |
| 890 | 890 |
| 891 #if defined(OS_WIN) | 891 #if defined(OS_WIN) |
| 892 int c = e.GetCharacter(); | 892 int c = e.GetCharacter(); |
| 893 // We don't process ALT + numpad digit as accelerators, they are used for | 893 // We don't process ALT + numpad digit as accelerators, they are used for |
| 894 // entering special characters. | 894 // entering special characters. We do translate alt-home. |
| 895 if (e.IsAltDown() && win_util::IsNumPadDigit(c, e.IsExtendedKey())) | 895 if (e.IsAltDown() && (c != VK_HOME) && |
| 896 win_util::IsNumPadDigit(c, e.IsExtendedKey())) |
| 896 return true; | 897 return true; |
| 897 | 898 |
| 898 // Skip accelerators for key combinations omnibox wants to crack. This list | 899 // Skip accelerators for key combinations omnibox wants to crack. This list |
| 899 // should be synced with AutocompleteEditViewWin::OnKeyDownOnlyWritable(). | 900 // should be synced with AutocompleteEditViewWin::OnKeyDownOnlyWritable(). |
| 900 // (but for tab which is dealt with above). | 901 // (but for tab which is dealt with above). |
| 901 // | 902 // |
| 902 // We cannot return true for all keys because we still need to handle some | 903 // We cannot return true for all keys because we still need to handle some |
| 903 // accelerators (e.g., F5 for reload the page should work even when the | 904 // accelerators (e.g., F5 for reload the page should work even when the |
| 904 // Omnibox gets focused). | 905 // Omnibox gets focused). |
| 905 switch (c) { | 906 switch (c) { |
| 906 case VK_RETURN: | 907 case VK_RETURN: |
| 907 return true; | 908 return true; |
| 908 | 909 |
| 909 case VK_UP: | 910 case VK_UP: |
| 910 case VK_DOWN: | 911 case VK_DOWN: |
| 911 return !e.IsAltDown(); | 912 return !e.IsAltDown(); |
| 912 | 913 |
| 913 case VK_DELETE: | 914 case VK_DELETE: |
| 914 case VK_INSERT: | 915 case VK_INSERT: |
| 915 return !e.IsAltDown() && e.IsShiftDown(); | 916 return !e.IsAltDown() && e.IsShiftDown(); |
| 916 | 917 |
| 917 case 'X': | 918 case 'X': |
| 918 case 'V': | 919 case 'V': |
| 919 return !e.IsAltDown() && e.IsControlDown(); | 920 return !e.IsAltDown() && e.IsControlDown(); |
| 920 | 921 |
| 921 case VK_BACK: | 922 case VK_BACK: |
| 922 case 0xbb: | 923 case 0xbb: |
| 923 return true; | 924 return true; |
| 924 | 925 |
| 925 default: | 926 default: |
| 926 return false; | 927 return false; |
| 927 } | 928 } |
| 928 #else | 929 #else |
| 929 NOTIMPLEMENTED(); | 930 NOTIMPLEMENTED(); |
| 930 return false; | 931 return false; |
| 931 #endif | 932 #endif |
| 932 } | 933 } |
| 933 | 934 |
| 934 // ShowInfoBubbleTask----------------------------------------------------------- | 935 // ShowInfoBubbleTask----------------------------------------------------------- |
| 935 | 936 |
| 936 class LocationBarView::ShowInfoBubbleTask : public Task { | 937 class LocationBarView::ShowInfoBubbleTask : public Task { |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 location_entry_->SetFocus(); | 1336 location_entry_->SetFocus(); |
| 1336 } | 1337 } |
| 1337 | 1338 |
| 1338 void LocationBarView::SaveStateToContents(TabContents* contents) { | 1339 void LocationBarView::SaveStateToContents(TabContents* contents) { |
| 1339 location_entry_->SaveStateToTab(contents); | 1340 location_entry_->SaveStateToTab(contents); |
| 1340 } | 1341 } |
| 1341 | 1342 |
| 1342 void LocationBarView::Revert() { | 1343 void LocationBarView::Revert() { |
| 1343 location_entry_->RevertAll(); | 1344 location_entry_->RevertAll(); |
| 1344 } | 1345 } |
| OLD | NEW |