OLD | NEW |
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(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 } | 982 } |
983 | 983 |
984 std::string LocationBarView::GetClassName() const { | 984 std::string LocationBarView::GetClassName() const { |
985 return kViewClassName; | 985 return kViewClassName; |
986 } | 986 } |
987 | 987 |
988 bool LocationBarView::SkipDefaultKeyEventProcessing( | 988 bool LocationBarView::SkipDefaultKeyEventProcessing( |
989 const views::KeyEvent& event) { | 989 const views::KeyEvent& event) { |
990 #if defined(OS_WIN) | 990 #if defined(OS_WIN) |
991 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { | 991 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { |
992 if (HasValidSuggestText()) { | 992 return location_entry_->model()->popup_model()->IsOpen() || |
993 // Return true so that the edit sees the tab and commits the suggestion. | 993 (keyword_hint_view_->IsVisible() && !event.IsShiftDown()); |
994 return true; | |
995 } | |
996 if (keyword_hint_view_->IsVisible() && !event.IsShiftDown()) { | |
997 // Return true so the edit gets the tab event and enters keyword mode. | |
998 return true; | |
999 } | |
1000 | |
1001 // If the caret is not at the end, then tab moves the caret to the end. | |
1002 if (!location_entry_->IsCaretAtEnd()) | |
1003 return true; | |
1004 | |
1005 // Tab while showing instant commits instant immediately. | |
1006 // Return true so that focus traversal isn't attempted. The edit ends | |
1007 // up doing nothing in this case. | |
1008 if (location_entry_->model()->AcceptCurrentInstantPreview()) | |
1009 return true; | |
1010 } | 994 } |
1011 | 995 |
1012 return location_entry_->SkipDefaultKeyEventProcessing(event); | 996 return location_entry_->SkipDefaultKeyEventProcessing(event); |
1013 #else | 997 #else |
1014 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in | 998 // This method is not used for Linux ports. See FocusManager::OnKeyEvent() in |
1015 // src/views/focus/focus_manager.cc for details. | 999 // src/views/focus/focus_manager.cc for details. |
1016 return false; | 1000 return false; |
1017 #endif | 1001 #endif |
1018 } | 1002 } |
1019 | 1003 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 template_url_model_ = NULL; | 1169 template_url_model_ = NULL; |
1186 ShowFirstRunBubble(bubble_type_); | 1170 ShowFirstRunBubble(bubble_type_); |
1187 } | 1171 } |
1188 | 1172 |
1189 #if defined(OS_WIN) | 1173 #if defined(OS_WIN) |
1190 bool LocationBarView::HasValidSuggestText() const { | 1174 bool LocationBarView::HasValidSuggestText() const { |
1191 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1175 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
1192 !suggested_text_view_->GetText().empty(); | 1176 !suggested_text_view_->GetText().empty(); |
1193 } | 1177 } |
1194 #endif | 1178 #endif |
OLD | NEW |