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 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 switch (key) { | 2151 switch (key) { |
2152 case VK_RIGHT: | 2152 case VK_RIGHT: |
2153 // TODO(sky): figure out RTL. | 2153 // TODO(sky): figure out RTL. |
2154 if (base::i18n::IsRTL()) | 2154 if (base::i18n::IsRTL()) |
2155 return false; | 2155 return false; |
2156 { | 2156 { |
2157 CHARRANGE selection; | 2157 CHARRANGE selection; |
2158 GetSel(selection); | 2158 GetSel(selection); |
2159 return (selection.cpMin == selection.cpMax) && | 2159 return (selection.cpMin == selection.cpMax) && |
2160 (selection.cpMin == GetTextLength()) && | 2160 (selection.cpMin == GetTextLength()) && |
2161 model()->CommitSuggestedText(true); | 2161 model()->CommitSuggestedText(); |
2162 } | 2162 } |
2163 | 2163 |
2164 case VK_RETURN: | 2164 case VK_RETURN: |
2165 model()->AcceptInput((flags & KF_ALTDOWN) ? | 2165 model()->AcceptInput((flags & KF_ALTDOWN) ? |
2166 NEW_FOREGROUND_TAB : CURRENT_TAB, false); | 2166 NEW_FOREGROUND_TAB : CURRENT_TAB, false); |
2167 return true; | 2167 return true; |
2168 | 2168 |
2169 case VK_PRIOR: | 2169 case VK_PRIOR: |
2170 case VK_NEXT: | 2170 case VK_NEXT: |
2171 count = model()->result().size(); | 2171 count = model()->result().size(); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2840 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
2841 } | 2841 } |
2842 | 2842 |
2843 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2843 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
2844 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because | 2844 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because |
2845 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with | 2845 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with |
2846 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than | 2846 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than |
2847 // 1. | 2847 // 1. |
2848 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2848 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2849 } | 2849 } |
OLD | NEW |