OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 // TODO(hbono): http://b/1111369 if we exclude this popup window from the | 959 // TODO(hbono): http://b/1111369 if we exclude this popup window from the |
960 // display area of IME windows, this workaround becomes unnecessary. | 960 // display area of IME windows, this workaround becomes unnecessary. |
961 HWND ime_window = ImmGetDefaultIMEWnd(edit_native_view); | 961 HWND ime_window = ImmGetDefaultIMEWnd(edit_native_view); |
962 return ime_window ? ime_window : HWND_NOTOPMOST; | 962 return ime_window ? ime_window : HWND_NOTOPMOST; |
963 } | 963 } |
964 | 964 |
965 gfx::NativeView OmniboxViewWin::GetRelativeWindowForPopup() const { | 965 gfx::NativeView OmniboxViewWin::GetRelativeWindowForPopup() const { |
966 return GetRelativeWindowForNativeView(GetNativeView()); | 966 return GetRelativeWindowForNativeView(GetNativeView()); |
967 } | 967 } |
968 | 968 |
969 void OmniboxViewWin::SetInstantSuggestion(const string16& suggestion, | 969 void OmniboxViewWin::SetInstantSuggestion(const string16& suggestion) { |
970 bool animate_to_complete) { | 970 parent_view_->SetInstantSuggestion(suggestion); |
971 parent_view_->SetInstantSuggestion(suggestion, animate_to_complete); | |
972 } | 971 } |
973 | 972 |
974 int OmniboxViewWin::TextWidth() const { | 973 int OmniboxViewWin::TextWidth() const { |
975 return WidthNeededToDisplay(GetText()); | 974 return WidthNeededToDisplay(GetText()); |
976 } | 975 } |
977 | 976 |
978 string16 OmniboxViewWin::GetInstantSuggestion() const { | 977 string16 OmniboxViewWin::GetInstantSuggestion() const { |
979 return parent_view_->GetInstantSuggestion(); | 978 return parent_view_->GetInstantSuggestion(); |
980 } | 979 } |
981 | 980 |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2756 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
2758 } | 2757 } |
2759 | 2758 |
2760 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2759 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
2761 // Use font_.GetStringWidth() instead of | 2760 // Use font_.GetStringWidth() instead of |
2762 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2761 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
2763 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2762 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
2764 // PosFromChar(i) might return 0 when i is greater than 1. | 2763 // PosFromChar(i) might return 0 when i is greater than 1. |
2765 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2764 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2766 } | 2765 } |
OLD | NEW |