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

Side by Side Diff: chrome/browser/dom_ui/dom_ui.cc

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | « chrome/browser/dom_ui/chrome_url_data_manager.cc ('k') | chrome/browser/dom_ui/new_tab_ui.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/dom_ui/dom_ui.h" 5 #include "chrome/browser/dom_ui/dom_ui.h"
6 6
7 #include "app/l10n_util.h" 7 #include "base/i18n/rtl.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/browser/browser_theme_provider.h" 13 #include "chrome/browser/browser_theme_provider.h"
13 #include "chrome/browser/profile.h" 14 #include "chrome/browser/profile.h"
14 #include "chrome/browser/renderer_host/render_view_host.h" 15 #include "chrome/browser/renderer_host/render_view_host.h"
15 #include "chrome/browser/tab_contents/tab_contents.h" 16 #include "chrome/browser/tab_contents/tab_contents.h"
16 #include "chrome/browser/tab_contents/tab_contents_view.h" 17 #include "chrome/browser/tab_contents/tab_contents_view.h"
17 #include "chrome/common/bindings_policy.h" 18 #include "chrome/common/bindings_policy.h"
18 19
19 DOMUI::DOMUI(TabContents* contents) 20 DOMUI::DOMUI(TabContents* contents)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (title.empty()) { 123 if (title.empty()) {
123 using_url_as_the_title = true; 124 using_url_as_the_title = true;
124 title = wstring_url; 125 title = wstring_url;
125 } 126 }
126 127
127 // Since the title can contain BiDi text, we need to mark the text as either 128 // Since the title can contain BiDi text, we need to mark the text as either
128 // RTL or LTR, depending on the characters in the string. If we use the URL 129 // RTL or LTR, depending on the characters in the string. If we use the URL
129 // as the title, we mark the title as LTR since URLs are always treated as 130 // as the title, we mark the title as LTR since URLs are always treated as
130 // left to right strings. 131 // left to right strings.
131 std::wstring title_to_set(title); 132 std::wstring title_to_set(title);
132 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { 133 if (base::i18n::IsRTL()) {
133 if (using_url_as_the_title) { 134 if (using_url_as_the_title) {
134 l10n_util::WrapStringWithLTRFormatting(&title_to_set); 135 base::i18n::WrapStringWithLTRFormatting(&title_to_set);
135 } else { 136 } else {
136 bool success = 137 bool success =
137 l10n_util::AdjustStringForLocaleDirection(title, &title_to_set); 138 base::i18n::AdjustStringForLocaleDirection(title, &title_to_set);
138 DCHECK(success ? (title != title_to_set) : (title == title_to_set)); 139 DCHECK(success ? (title != title_to_set) : (title == title_to_set));
139 } 140 }
140 } 141 }
141 dictionary->SetString(L"title", title_to_set); 142 dictionary->SetString(L"title", title_to_set);
142 } 143 }
143 144
144 bool DOMMessageHandler::ExtractIntegerValue(const Value* value, int* out_int) { 145 bool DOMMessageHandler::ExtractIntegerValue(const Value* value, int* out_int) {
145 if (value && value->GetType() == Value::TYPE_LIST) { 146 if (value && value->GetType() == Value::TYPE_LIST) {
146 const ListValue* list_value = static_cast<const ListValue*>(value); 147 const ListValue* list_value = static_cast<const ListValue*>(value);
147 Value* list_member; 148 Value* list_member;
(...skipping 23 matching lines...) Expand all
171 list_member->GetType() == Value::TYPE_STRING) { 172 list_member->GetType() == Value::TYPE_STRING) {
172 const StringValue* string_value = 173 const StringValue* string_value =
173 static_cast<const StringValue*>(list_member); 174 static_cast<const StringValue*>(list_member);
174 std::wstring wstring_value; 175 std::wstring wstring_value;
175 string_value->GetAsString(&wstring_value); 176 string_value->GetAsString(&wstring_value);
176 return wstring_value; 177 return wstring_value;
177 } 178 }
178 } 179 }
179 return std::wstring(); 180 return std::wstring();
180 } 181 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/chrome_url_data_manager.cc ('k') | chrome/browser/dom_ui/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698