OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/omnibox/omnibox_view_win.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_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 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2300 ScopedFreeze freeze(this, GetTextObjectModel()); | 2300 ScopedFreeze freeze(this, GetTextObjectModel()); |
2301 model()->ClearKeyword(GetText()); | 2301 model()->ClearKeyword(GetText()); |
2302 return true; | 2302 return true; |
2303 } | 2303 } |
2304 | 2304 |
2305 case VK_TAB: { | 2305 case VK_TAB: { |
2306 const bool shift_pressed = GetKeyState(VK_SHIFT) < 0; | 2306 const bool shift_pressed = GetKeyState(VK_SHIFT) < 0; |
2307 if (model()->is_keyword_hint() && !shift_pressed) { | 2307 if (model()->is_keyword_hint() && !shift_pressed) { |
2308 // Accept the keyword. | 2308 // Accept the keyword. |
2309 ScopedFreeze freeze(this, GetTextObjectModel()); | 2309 ScopedFreeze freeze(this, GetTextObjectModel()); |
2310 model()->AcceptKeyword(); | 2310 model()->AcceptKeyword(ENTERED_KEYWORD_MODE_VIA_TAB); |
2311 } else if (shift_pressed && | 2311 } else if (shift_pressed && |
2312 model()->popup_model()->selected_line_state() == | 2312 model()->popup_model()->selected_line_state() == |
2313 OmniboxPopupModel::KEYWORD) { | 2313 OmniboxPopupModel::KEYWORD) { |
2314 model()->ClearKeyword(GetText()); | 2314 model()->ClearKeyword(GetText()); |
2315 } else { | 2315 } else { |
2316 model()->OnUpOrDownKeyPressed(shift_pressed ? -count : count); | 2316 model()->OnUpOrDownKeyPressed(shift_pressed ? -count : count); |
2317 } | 2317 } |
2318 return true; | 2318 return true; |
2319 } | 2319 } |
2320 | 2320 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2857 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
2858 } | 2858 } |
2859 | 2859 |
2860 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2860 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
2861 // Use font_.GetStringWidth() instead of | 2861 // Use font_.GetStringWidth() instead of |
2862 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2862 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
2863 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2863 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
2864 // PosFromChar(i) might return 0 when i is greater than 1. | 2864 // PosFromChar(i) might return 0 when i is greater than 1. |
2865 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2865 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2866 } | 2866 } |
OLD | NEW |