Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1267)

Side by Side Diff: chrome/browser/views/location_bar_view.cc

Issue 99228: Landing Hamaji accelerator clean-up patch (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/task_manager.cc ('k') | chrome/views/controls/tree/tree_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
10 #include "chrome/browser/alternate_nav_url_fetcher.h" 10 #include "chrome/browser/alternate_nav_url_fetcher.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 if (show_labels) { 781 if (show_labels) {
782 pref = leading_label_.GetPreferredSize(); 782 pref = leading_label_.GetPreferredSize();
783 leading_label_.SetBounds(x, 0, pref.width(), height()); 783 leading_label_.SetBounds(x, 0, pref.width(), height());
784 784
785 x += pref.width() + kTabButtonBitmap->width(); 785 x += pref.width() + kTabButtonBitmap->width();
786 pref = trailing_label_.GetPreferredSize(); 786 pref = trailing_label_.GetPreferredSize();
787 trailing_label_.SetBounds(x, 0, pref.width(), height()); 787 trailing_label_.SetBounds(x, 0, pref.width(), height());
788 } 788 }
789 } 789 }
790 790
791 // We don't translate accelerators for ALT + numpad digit, they are used for
792 // entering special characters.
793 bool LocationBarView::ShouldLookupAccelerators(const views::KeyEvent& e) { 791 bool LocationBarView::ShouldLookupAccelerators(const views::KeyEvent& e) {
794 if (!e.IsAltDown()) 792 int c = e.GetCharacter();
793 // We don't translate accelerators for ALT + numpad digit, they are used for
794 // entering special characters.
795 if (e.IsAltDown() && win_util::IsNumPadDigit(c, e.IsExtendedKey()))
796 return false;
797
798 // Skip accelerators for key combinations omnibox wants to crack. This list
799 // should be synced with AutocompleteEditViewWin::OnKeyDownOnlyWritable().
800 //
801 // We cannot return false for all keys because we still need to handle some
802 // accelerators (e.g., F5 for reload the page should work even when the
803 // Omnibox gets focused).
804 switch (c) {
805 case VK_RETURN:
806 return false;
807
808 case VK_UP:
809 case VK_DOWN:
810 return e.IsAltDown();
811
812 case VK_DELETE:
813 case VK_INSERT:
814 return e.IsAltDown() || !e.IsShiftDown();
815
816 case 'X':
817 case 'V':
818 return e.IsAltDown() || !e.IsControlDown();
819
820 case VK_BACK:
821 case VK_TAB:
822 case 0xbb:
823 return false;
824
825 default:
795 return true; 826 return true;
796 827 }
797 return !win_util::IsNumPadDigit(e.GetCharacter(), e.IsExtendedKey());
798 } 828 }
799 829
800 // ShowInfoBubbleTask----------------------------------------------------------- 830 // ShowInfoBubbleTask-----------------------------------------------------------
801 831
802 class LocationBarView::ShowInfoBubbleTask : public Task { 832 class LocationBarView::ShowInfoBubbleTask : public Task {
803 public: 833 public:
804 explicit ShowInfoBubbleTask( 834 explicit ShowInfoBubbleTask(
805 LocationBarView::LocationBarImageView* image_view); 835 LocationBarView::LocationBarImageView* image_view);
806 virtual void Run(); 836 virtual void Run();
807 void Cancel(); 837 void Cancel();
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 } 1119 }
1090 1120
1091 void LocationBarView::FocusSearch() { 1121 void LocationBarView::FocusSearch() {
1092 location_entry_->SetUserText(L"?"); 1122 location_entry_->SetUserText(L"?");
1093 location_entry_->SetFocus(); 1123 location_entry_->SetFocus();
1094 } 1124 }
1095 1125
1096 void LocationBarView::SaveStateToContents(TabContents* contents) { 1126 void LocationBarView::SaveStateToContents(TabContents* contents) {
1097 location_entry_->SaveStateToTab(contents); 1127 location_entry_->SaveStateToTab(contents);
1098 } 1128 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager.cc ('k') | chrome/views/controls/tree/tree_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698