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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_win.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, 8 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/autocomplete/autocomplete_edit_view_win.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <locale> 8 #include <locale>
9 #include <string> 9 #include <string>
10 10
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 } 2012 }
2013 2013
2014 // We're showing a keyword and the user pressed backspace at the beginning 2014 // We're showing a keyword and the user pressed backspace at the beginning
2015 // of the text. Delete the selected keyword. 2015 // of the text. Delete the selected keyword.
2016 ScopedFreeze freeze(this, GetTextObjectModel()); 2016 ScopedFreeze freeze(this, GetTextObjectModel());
2017 model_->ClearKeyword(GetText()); 2017 model_->ClearKeyword(GetText());
2018 return true; 2018 return true;
2019 } 2019 }
2020 2020
2021 case VK_TAB: { 2021 case VK_TAB: {
2022 if (model_->is_keyword_hint()) { 2022 const bool shift_pressed = GetKeyState(VK_SHIFT) < 0;
2023 if (model_->is_keyword_hint() && !shift_pressed) {
2023 // Accept the keyword. 2024 // Accept the keyword.
2024 ScopedFreeze freeze(this, GetTextObjectModel()); 2025 ScopedFreeze freeze(this, GetTextObjectModel());
2025 model_->AcceptKeyword(); 2026 model_->AcceptKeyword();
2026 } else if (!IsCaretAtEnd()) {
2027 ScopedFreeze freeze(this, GetTextObjectModel());
2028 OnBeforePossibleChange();
2029 PlaceCaretAt(GetTextLength());
2030 OnAfterPossibleChange();
2031 } else { 2027 } else {
2032 model_->CommitSuggestedText(true); 2028 model_->OnUpOrDownKeyPressed(shift_pressed ? -count : count);
2033 } 2029 }
2034 return true; 2030 return true;
2035 } 2031 }
2036 2032
2037 case 0xbb: // Ctrl-'='. Triggers subscripting (even in plain text mode). 2033 case 0xbb: // Ctrl-'='. Triggers subscripting (even in plain text mode).
2038 // We don't use VK_OEM_PLUS in case the macro isn't defined. 2034 // We don't use VK_OEM_PLUS in case the macro isn't defined.
2039 // (e.g., we don't have this symbol in embeded environment). 2035 // (e.g., we don't have this symbol in embeded environment).
2040 return true; 2036 return true;
2041 2037
2042 default: 2038 default:
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 // PosFromChar(i) might return 0 when i is greater than 1. 2616 // PosFromChar(i) might return 0 when i is greater than 1.
2621 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2617 return font_.GetStringWidth(text) + GetHorizontalMargin();
2622 } 2618 }
2623 2619
2624 bool AutocompleteEditViewWin::IsCaretAtEnd() const { 2620 bool AutocompleteEditViewWin::IsCaretAtEnd() const {
2625 long length = GetTextLength(); 2621 long length = GetTextLength();
2626 CHARRANGE sel; 2622 CHARRANGE sel;
2627 GetSelection(sel); 2623 GetSelection(sel);
2628 return sel.cpMin == sel.cpMax && sel.cpMin == length; 2624 return sel.cpMin == sel.cpMax && sel.cpMin == length;
2629 } 2625 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698