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 "content/browser/renderer_host/render_widget_host.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 // Is that really what we want in response to this message? I'm matching | 808 // Is that really what we want in response to this message? I'm matching |
809 // previous behavior of the code here. | 809 // previous behavior of the code here. |
810 Destroy(); | 810 Destroy(); |
811 } | 811 } |
812 | 812 |
813 void RenderWidgetHost::OnMsgClose() { | 813 void RenderWidgetHost::OnMsgClose() { |
814 Shutdown(); | 814 Shutdown(); |
815 } | 815 } |
816 | 816 |
817 void RenderWidgetHost::OnMsgSetTooltipText( | 817 void RenderWidgetHost::OnMsgSetTooltipText( |
818 const std::wstring& tooltip_text, | 818 const string16& tooltip_text, |
819 WebTextDirection text_direction_hint) { | 819 WebTextDirection text_direction_hint) { |
820 // First, add directionality marks around tooltip text if necessary. | 820 // First, add directionality marks around tooltip text if necessary. |
821 // A naive solution would be to simply always wrap the text. However, on | 821 // A naive solution would be to simply always wrap the text. However, on |
822 // windows, Unicode directional embedding characters can't be displayed on | 822 // windows, Unicode directional embedding characters can't be displayed on |
823 // systems that lack RTL fonts and are instead displayed as empty squares. | 823 // systems that lack RTL fonts and are instead displayed as empty squares. |
824 // | 824 // |
825 // To get around this we only wrap the string when we deem it necessary i.e. | 825 // To get around this we only wrap the string when we deem it necessary i.e. |
826 // when the locale direction is different than the tooltip direction hint. | 826 // when the locale direction is different than the tooltip direction hint. |
827 // | 827 // |
828 // Currently, we use element's directionality as the tooltip direction hint. | 828 // Currently, we use element's directionality as the tooltip direction hint. |
829 // An alternate solution would be to set the overall directionality based on | 829 // An alternate solution would be to set the overall directionality based on |
830 // trying to detect the directionality from the tooltip text rather than the | 830 // trying to detect the directionality from the tooltip text rather than the |
831 // element direction. One could argue that would be a preferable solution | 831 // element direction. One could argue that would be a preferable solution |
832 // but we use the current approach to match Fx & IE's behavior. | 832 // but we use the current approach to match Fx & IE's behavior. |
833 string16 wrapped_tooltip_text = WideToUTF16(tooltip_text); | 833 string16 wrapped_tooltip_text = tooltip_text; |
834 if (!tooltip_text.empty()) { | 834 if (!tooltip_text.empty()) { |
835 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) { | 835 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) { |
836 // Force the tooltip to have LTR directionality. | 836 // Force the tooltip to have LTR directionality. |
837 wrapped_tooltip_text = | 837 wrapped_tooltip_text = |
838 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); | 838 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); |
839 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft && | 839 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft && |
840 !base::i18n::IsRTL()) { | 840 !base::i18n::IsRTL()) { |
841 // Force the tooltip to have RTL directionality. | 841 // Force the tooltip to have RTL directionality. |
842 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); | 842 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); |
843 } | 843 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 view_->CreatePluginContainer(deferred_plugin_handles_[i]); | 1203 view_->CreatePluginContainer(deferred_plugin_handles_[i]); |
1204 #endif | 1204 #endif |
1205 } | 1205 } |
1206 | 1206 |
1207 deferred_plugin_handles_.clear(); | 1207 deferred_plugin_handles_.clear(); |
1208 } | 1208 } |
1209 | 1209 |
1210 void RenderWidgetHost::StartUserGesture() { | 1210 void RenderWidgetHost::StartUserGesture() { |
1211 OnUserGesture(); | 1211 OnUserGesture(); |
1212 } | 1212 } |
OLD | NEW |