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

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

Issue 9419043: Revert 122412 - Enabled pressing TAB to traverse through the Omnibox results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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
OLDNEW
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/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #if defined(TOOLKIT_USES_GTK) 7 #if defined(TOOLKIT_USES_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 #endif 1010 #endif
1011 } 1011 }
1012 1012
1013 std::string LocationBarView::GetClassName() const { 1013 std::string LocationBarView::GetClassName() const {
1014 return kViewClassName; 1014 return kViewClassName;
1015 } 1015 }
1016 1016
1017 bool LocationBarView::SkipDefaultKeyEventProcessing( 1017 bool LocationBarView::SkipDefaultKeyEventProcessing(
1018 const views::KeyEvent& event) { 1018 const views::KeyEvent& event) {
1019 #if defined(OS_WIN) 1019 #if defined(OS_WIN)
1020 bool views_omnibox = views::Widget::IsPureViews();
1020 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { 1021 if (views::FocusManager::IsTabTraversalKeyEvent(event)) {
1021 if (location_entry_->model()->popup_model()->IsOpen()) { 1022 if (HasValidSuggestText()) {
1022 // Return true so that the edit sees the tab and moves the selection. 1023 // Return true so that the edit sees the tab and commits the suggestion.
1023 return true; 1024 return true;
1024 } 1025 }
1025 if (keyword_hint_view_->visible() && !event.IsShiftDown()) { 1026 if (keyword_hint_view_->visible() && !event.IsShiftDown()) {
1026 // Return true so the edit gets the tab event and enters keyword mode. 1027 // Return true so the edit gets the tab event and enters keyword mode.
1027 return true; 1028 return true;
1028 } 1029 }
1029 1030
1031 #if !defined(USE_AURA)
1032 // If the caret is not at the end, then tab moves the caret to the end.
1033 if (!views_omnibox && !GetOmniboxViewWin()->IsCaretAtEnd())
1034 return true;
1035 #endif
1036
1030 // Tab while showing instant commits instant immediately. 1037 // Tab while showing instant commits instant immediately.
1031 // Return true so that focus traversal isn't attempted. The edit ends 1038 // Return true so that focus traversal isn't attempted. The edit ends
1032 // up doing nothing in this case. 1039 // up doing nothing in this case.
1033 if (location_entry_->model()->AcceptCurrentInstantPreview()) 1040 if (location_entry_->model()->AcceptCurrentInstantPreview())
1034 return true; 1041 return true;
1035 } 1042 }
1036 1043
1037 #if !defined(USE_AURA) 1044 #if !defined(USE_AURA)
1038 if (!views::Widget::IsPureViews()) 1045 if (!views_omnibox)
1039 return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event); 1046 return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event);
1040 #endif 1047 #endif
1041 NOTIMPLEMENTED(); 1048 NOTIMPLEMENTED();
1042 return false; 1049 return false;
1043 #else 1050 #else
1044 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in 1051 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in
1045 // src/ui/views/focus/focus_manager.cc for details. 1052 // src/ui/views/focus/focus_manager.cc for details.
1046 return false; 1053 return false;
1047 #endif 1054 #endif
1048 } 1055 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 !suggested_text_view_->GetText().empty(); 1243 !suggested_text_view_->GetText().empty();
1237 } 1244 }
1238 1245
1239 #if !defined(USE_AURA) 1246 #if !defined(USE_AURA)
1240 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1247 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1241 CHECK(!views::Widget::IsPureViews()); 1248 CHECK(!views::Widget::IsPureViews());
1242 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1249 return static_cast<OmniboxViewWin*>(location_entry_.get());
1243 } 1250 }
1244 #endif 1251 #endif
1245 #endif 1252 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698