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

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, 5 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(); 1036 if (views::FocusManager::IsTabTraversalKeyEvent(event) &&
1037 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { 1037 (location_entry_->model()->popup_model()->IsOpen() ||
1038 if (HasValidSuggestText()) { 1038 (keyword_hint_view_->IsVisible() && !event.IsShiftDown()))) {
1039 // Return true so that the edit sees the tab and commits the suggestion. 1039 return true;
1040 return true;
1041 }
1042 if (keyword_hint_view_->IsVisible() && !event.IsShiftDown()) {
1043 // Return true so the edit gets the tab event and enters keyword mode.
1044 return true;
1045 }
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.
Peter Kasting 2011/07/27 20:18:25 I think this change depends on us ditching this be
1052 // Return true so that focus traversal isn't attempted. The edit ends
1053 // up doing nothing in this case.
1054 if (location_entry_->model()->AcceptCurrentInstantPreview())
1055 return true;
1056 } 1040 }
1057 1041
1058 if (!views_omnibox) 1042 if (!views::Widget::IsPureViews())
1059 return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event); 1043 return GetOmniboxViewWin()->SkipDefaultKeyEventProcessing(event);
1060 NOTIMPLEMENTED(); 1044 NOTIMPLEMENTED();
1061 return false; 1045 return false;
1062 #else 1046 #else
1063 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in 1047 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in
1064 // src/views/focus/focus_manager.cc for details. 1048 // src/views/focus/focus_manager.cc for details.
1065 return false; 1049 return false;
1066 #endif 1050 #endif
1067 } 1051 }
1068 1052
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 bool LocationBarView::HasValidSuggestText() const { 1238 bool LocationBarView::HasValidSuggestText() const {
1255 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1239 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1256 !suggested_text_view_->GetText().empty(); 1240 !suggested_text_view_->GetText().empty();
1257 } 1241 }
1258 1242
1259 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1243 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1260 CHECK(!views::Widget::IsPureViews()); 1244 CHECK(!views::Widget::IsPureViews());
1261 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1245 return static_cast<OmniboxViewWin*>(location_entry_.get());
1262 } 1246 }
1263 #endif 1247 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698