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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 391923006: Extra parameter to pass sub-message direction for validation message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated to latest master Created 6 years, 3 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
OLDNEW
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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 ipc_params.accept_types.reserve(params.acceptTypes.size()); 1802 ipc_params.accept_types.reserve(params.acceptTypes.size());
1803 for (size_t i = 0; i < params.acceptTypes.size(); ++i) 1803 for (size_t i = 0; i < params.acceptTypes.size(); ++i)
1804 ipc_params.accept_types.push_back(params.acceptTypes[i]); 1804 ipc_params.accept_types.push_back(params.acceptTypes[i]);
1805 #if defined(OS_ANDROID) 1805 #if defined(OS_ANDROID)
1806 ipc_params.capture = params.useMediaCapture; 1806 ipc_params.capture = params.useMediaCapture;
1807 #endif 1807 #endif
1808 1808
1809 return ScheduleFileChooser(ipc_params, chooser_completion); 1809 return ScheduleFileChooser(ipc_params, chooser_completion);
1810 } 1810 }
1811 1811
1812 void RenderViewImpl::SetValidationMessageDirection(
1813 base::string16* wrapped_main_text,
1814 blink::WebTextDirection main_text_hint,
1815 base::string16* wrapped_sub_text,
1816 blink::WebTextDirection sub_text_hint) {
1817 if (main_text_hint == blink::WebTextDirectionLeftToRight) {
1818 *wrapped_main_text =
1819 base::i18n::GetDisplayStringInLTRDirectionality(*wrapped_main_text);
1820 } else if (main_text_hint == blink::WebTextDirectionRightToLeft &&
1821 !base::i18n::IsRTL()) {
1822 base::i18n::WrapStringWithRTLFormatting(wrapped_main_text);
1823 }
1824
1825 if (!wrapped_sub_text->empty()) {
1826 if (sub_text_hint == blink::WebTextDirectionLeftToRight) {
1827 *wrapped_sub_text =
1828 base::i18n::GetDisplayStringInLTRDirectionality(*wrapped_sub_text);
1829 } else if (sub_text_hint == blink::WebTextDirectionRightToLeft) {
1830 base::i18n::WrapStringWithRTLFormatting(wrapped_sub_text);
1831 }
1832 }
1833 }
1834
1812 void RenderViewImpl::showValidationMessage( 1835 void RenderViewImpl::showValidationMessage(
1813 const blink::WebRect& anchor_in_root_view, 1836 const blink::WebRect& anchor_in_root_view,
1814 const blink::WebString& main_text, 1837 const blink::WebString& main_text,
1838 blink::WebTextDirection main_text_hint,
1815 const blink::WebString& sub_text, 1839 const blink::WebString& sub_text,
1816 blink::WebTextDirection hint) { 1840 blink::WebTextDirection sub_text_hint) {
1817 base::string16 wrapped_main_text = main_text; 1841 base::string16 wrapped_main_text = main_text;
1818 base::string16 wrapped_sub_text = sub_text; 1842 base::string16 wrapped_sub_text = sub_text;
1819 if (hint == blink::WebTextDirectionLeftToRight) { 1843
1820 wrapped_main_text = 1844 SetValidationMessageDirection(
1821 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_main_text); 1845 &wrapped_main_text, main_text_hint, &wrapped_sub_text, sub_text_hint);
1822 if (!wrapped_sub_text.empty()) { 1846
1823 wrapped_sub_text =
1824 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_sub_text);
1825 }
1826 } else if (hint == blink::WebTextDirectionRightToLeft
1827 && !base::i18n::IsRTL()) {
1828 base::i18n::WrapStringWithRTLFormatting(&wrapped_main_text);
1829 if (!wrapped_sub_text.empty()) {
1830 base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text);
1831 }
1832 }
1833 Send(new ViewHostMsg_ShowValidationMessage( 1847 Send(new ViewHostMsg_ShowValidationMessage(
1834 routing_id(), AdjustValidationMessageAnchor(anchor_in_root_view), 1848 routing_id(), AdjustValidationMessageAnchor(anchor_in_root_view),
1835 wrapped_main_text, wrapped_sub_text)); 1849 wrapped_main_text, wrapped_sub_text));
1836 } 1850 }
1837 1851
1838 void RenderViewImpl::hideValidationMessage() { 1852 void RenderViewImpl::hideValidationMessage() {
1839 Send(new ViewHostMsg_HideValidationMessage(routing_id())); 1853 Send(new ViewHostMsg_HideValidationMessage(routing_id()));
1840 } 1854 }
1841 1855
1842 void RenderViewImpl::moveValidationMessage( 1856 void RenderViewImpl::moveValidationMessage(
(...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after
4191 std::vector<gfx::Size> sizes; 4205 std::vector<gfx::Size> sizes;
4192 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4206 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4193 if (!url.isEmpty()) 4207 if (!url.isEmpty())
4194 urls.push_back( 4208 urls.push_back(
4195 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4209 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4196 } 4210 }
4197 SendUpdateFaviconURL(urls); 4211 SendUpdateFaviconURL(urls);
4198 } 4212 }
4199 4213
4200 } // namespace content 4214 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/shell/renderer/test_runner/web_test_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698