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

Unified Diff: content/browser/renderer_host/render_view_host.cc

Issue 7453050: Plumb the title direction up to the renderer host (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host.cc
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index d7526b6c76f4f3024109c0ca2788e6114da6f1fe..af7823abd2ad21c0bf1dd7f6aec48408a3d1e2a0 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -56,13 +56,26 @@ using WebKit::WebDragOperationNone;
using WebKit::WebDragOperationsMask;
using WebKit::WebInputEvent;
using WebKit::WebMediaPlayerAction;
-using WebKit::WebTextDirection;
namespace {
// Delay to wait on closing the tab for a beforeunload/unload handler to fire.
const int kUnloadTimeoutMS = 1000;
+// Translate a WebKit text direction into a base::i18n one.
+base::i18n::TextDirection WebTextDirectionToChromeTextDirection(
+ WebKit::WebTextDirection dir) {
+ switch (dir) {
+ case WebKit::WebTextDirectionLeftToRight:
+ return base::i18n::LEFT_TO_RIGHT;
+ case WebKit::WebTextDirectionRightToLeft:
+ return base::i18n::LEFT_TO_RIGHT;
jeremy 2011/08/02 09:34:37 I think you mean RIGHT_TO_LEFT
+ default:
+ NOTREACHED();
+ return base::i18n::UNKNOWN_DIRECTION;
+ }
+}
+
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -882,13 +895,18 @@ void RenderViewHost::OnMsgUpdateState(int32 page_id,
delegate_->UpdateState(this, page_id, state);
}
-void RenderViewHost::OnMsgUpdateTitle(int32 page_id,
- const string16& title) {
+void RenderViewHost::OnMsgUpdateTitle(
+ int32 page_id,
+ const string16& title,
+ WebKit::WebTextDirection title_direction) {
if (title.length() > content::kMaxTitleChars) {
NOTREACHED() << "Renderer sent too many characters in title.";
return;
}
- delegate_->UpdateTitle(this, page_id, title);
+
+ delegate_->UpdateTitle(this, page_id, title,
+ WebTextDirectionToChromeTextDirection(
+ title_direction));
}
void RenderViewHost::OnMsgUpdateEncoding(const std::string& encoding_name) {

Powered by Google App Engine
This is Rietveld 408576698