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

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

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 #endif 1026 #endif
1027 } 1027 }
1028 1028
1029 std::string LocationBarView::GetClassName() const { 1029 std::string LocationBarView::GetClassName() const {
1030 return kViewClassName; 1030 return kViewClassName;
1031 } 1031 }
1032 1032
1033 bool LocationBarView::SkipDefaultKeyEventProcessing( 1033 bool LocationBarView::SkipDefaultKeyEventProcessing(
1034 const views::KeyEvent& event) { 1034 const views::KeyEvent& event) {
1035 #if defined(OS_WIN) 1035 #if defined(OS_WIN)
1036 bool views_omnibox = views::Widget::IsPureViews();
1037 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { 1036 if (views::FocusManager::IsTabTraversalKeyEvent(event)) {
1038 if (HasValidSuggestText()) { 1037 if (location_entry_->model()->popup_model()->IsOpen()) {
1039 // Return true so that the edit sees the tab and commits the suggestion. 1038 // Return true so that the edit sees the tab and moves the selection.
1040 return true; 1039 return true;
1041 } 1040 }
1041
1042 if (keyword_hint_view_->IsVisible() && !event.IsShiftDown()) { 1042 if (keyword_hint_view_->IsVisible() && !event.IsShiftDown()) {
1043 // Return true so the edit gets the tab event and enters keyword mode. 1043 // Return true so the edit gets the tab event and enters keyword mode.
1044 return true; 1044 return true;
1045 } 1045 }
1046 1046
1047 // If the caret is not at the end, then tab moves the caret to the end.
1048 if (!views_omnibox && !GetOmniboxViewWin()->IsCaretAtEnd())
1049 return true;
1050
1051 // Tab while showing instant commits instant immediately. 1047 // Tab while showing instant commits instant immediately.
Peter Kasting 2011/07/29 21:08:44 sky should still look at this to see if this order
1052 // Return true so that focus traversal isn't attempted. The edit ends 1048 // Return true so that focus traversal isn't attempted. The edit ends
1053 // up doing nothing in this case. 1049 // up doing nothing in this case.
1054 if (location_entry_->model()->AcceptCurrentInstantPreview()) 1050 if (location_entry_->model()->AcceptCurrentInstantPreview())
1055 return true; 1051 return true;
1056 } 1052 }
1057 1053
1058 if (!views_omnibox) 1054 if (!views::Widget::IsPureViews())
1059 return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event); 1055 return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event);
1060 NOTIMPLEMENTED(); 1056 NOTIMPLEMENTED();
1061 return false; 1057 return false;
1062 #else 1058 #else
1063 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in 1059 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in
1064 // src/views/focus/focus_manager.cc for details. 1060 // src/views/focus/focus_manager.cc for details.
1065 return false; 1061 return false;
1066 #endif 1062 #endif
1067 } 1063 }
1068 1064
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 bool LocationBarView::HasValidSuggestText() const { 1250 bool LocationBarView::HasValidSuggestText() const {
1255 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1251 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1256 !suggested_text_view_->GetText().empty(); 1252 !suggested_text_view_->GetText().empty();
1257 } 1253 }
1258 1254
1259 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1255 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1260 CHECK(!views::Widget::IsPureViews()); 1256 CHECK(!views::Widget::IsPureViews());
1261 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1257 return static_cast<OmniboxViewWin*>(location_entry_.get());
1262 } 1258 }
1263 #endif 1259 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698