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

Side by Side Diff: content/browser/renderer_host/render_widget_host.cc

Issue 6974007: Move setToolTipText related functions from RenderView to RenderWidget. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Check tool tip is empty in Mac code. Created 9 years, 7 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/message_loop.h" 11 #include "base/message_loop.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/accessibility/browser_accessibility_state.h" 14 #include "chrome/browser/accessibility/browser_accessibility_state.h"
13 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
14 #include "content/browser/gpu/gpu_process_host.h" 16 #include "content/browser/gpu/gpu_process_host.h"
15 #include "content/browser/renderer_host/backing_store.h" 17 #include "content/browser/renderer_host/backing_store.h"
16 #include "content/browser/renderer_host/backing_store_manager.h" 18 #include "content/browser/renderer_host/backing_store_manager.h"
17 #include "content/browser/renderer_host/render_process_host.h" 19 #include "content/browser/renderer_host/render_process_host.h"
18 #include "content/browser/renderer_host/render_widget_helper.h" 20 #include "content/browser/renderer_host/render_widget_helper.h"
19 #include "content/browser/renderer_host/render_widget_host_view.h" 21 #include "content/browser/renderer_host/render_widget_host_view.h"
20 #include "content/browser/user_metrics.h" 22 #include "content/browser/user_metrics.h"
21 #include "content/common/gpu/gpu_messages.h" 23 #include "content/common/gpu/gpu_messages.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 161 }
160 162
161 bool RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { 163 bool RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) {
162 bool handled = true; 164 bool handled = true;
163 bool msg_is_ok = true; 165 bool msg_is_ok = true;
164 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) 166 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok)
165 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) 167 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady)
166 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) 168 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone)
167 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) 169 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
168 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) 170 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
171 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
169 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) 172 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck)
170 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) 173 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect)
171 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) 174 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
172 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) 175 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
173 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) 176 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
174 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) 177 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
175 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateTextInputState, 178 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateTextInputState,
176 OnMsgImeUpdateTextInputState) 179 OnMsgImeUpdateTextInputState)
177 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, 180 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
178 OnMsgImeCompositionRangeChanged) 181 OnMsgImeCompositionRangeChanged)
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 // TODO(evanm): This synchronously ends up calling "delete this". 799 // TODO(evanm): This synchronously ends up calling "delete this".
797 // Is that really what we want in response to this message? I'm matching 800 // Is that really what we want in response to this message? I'm matching
798 // previous behavior of the code here. 801 // previous behavior of the code here.
799 Destroy(); 802 Destroy();
800 } 803 }
801 804
802 void RenderWidgetHost::OnMsgClose() { 805 void RenderWidgetHost::OnMsgClose() {
803 Shutdown(); 806 Shutdown();
804 } 807 }
805 808
809 void RenderWidgetHost::OnMsgSetTooltipText(
810 const std::wstring& tooltip_text,
811 WebTextDirection text_direction_hint) {
812 // First, add directionality marks around tooltip text if necessary.
813 // A naive solution would be to simply always wrap the text. However, on
814 // windows, Unicode directional embedding characters can't be displayed on
815 // systems that lack RTL fonts and are instead displayed as empty squares.
816 //
817 // To get around this we only wrap the string when we deem it necessary i.e.
818 // when the locale direction is different than the tooltip direction hint.
819 //
820 // Currently, we use element's directionality as the tooltip direction hint.
821 // An alternate solution would be to set the overall directionality based on
822 // trying to detect the directionality from the tooltip text rather than the
823 // element direction. One could argue that would be a preferable solution
824 // but we use the current approach to match Fx & IE's behavior.
825 string16 wrapped_tooltip_text = WideToUTF16(tooltip_text);
826 if (!tooltip_text.empty()) {
827 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) {
828 // Force the tooltip to have LTR directionality.
829 wrapped_tooltip_text =
830 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text);
831 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft &&
832 !base::i18n::IsRTL()) {
833 // Force the tooltip to have RTL directionality.
834 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text);
835 }
836 }
837 if (view())
838 view()->SetTooltipText(UTF16ToWide(wrapped_tooltip_text));
839 }
840
806 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) { 841 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) {
807 // Note that we ignore the position. 842 // Note that we ignore the position.
808 if (view_) { 843 if (view_) {
809 view_->SetBounds(pos); 844 view_->SetBounds(pos);
810 Send(new ViewMsg_Move_ACK(routing_id_)); 845 Send(new ViewMsg_Move_ACK(routing_id_));
811 } 846 }
812 } 847 }
813 848
814 void RenderWidgetHost::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) { 849 void RenderWidgetHost::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) {
815 PaintAtSizeAckDetails details = {tag, size}; 850 PaintAtSizeAckDetails details = {tag, size};
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 view_->CreatePluginContainer(deferred_plugin_handles_[i]); 1306 view_->CreatePluginContainer(deferred_plugin_handles_[i]);
1272 #endif 1307 #endif
1273 } 1308 }
1274 1309
1275 deferred_plugin_handles_.clear(); 1310 deferred_plugin_handles_.clear();
1276 } 1311 }
1277 1312
1278 void RenderWidgetHost::StartUserGesture() { 1313 void RenderWidgetHost::StartUserGesture() {
1279 OnUserGesture(); 1314 OnUserGesture();
1280 } 1315 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698