| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 683 |
| 684 NOTREACHED() << "Unknown image resource " << name; | 684 NOTREACHED() << "Unknown image resource " << name; |
| 685 return WebData(); | 685 return WebData(); |
| 686 } | 686 } |
| 687 | 687 |
| 688 WebString BlinkPlatformImpl::queryLocalizedString( | 688 WebString BlinkPlatformImpl::queryLocalizedString( |
| 689 WebLocalizedString::Name name) { | 689 WebLocalizedString::Name name) { |
| 690 int message_id = ToMessageID(name); | 690 int message_id = ToMessageID(name); |
| 691 if (message_id < 0) | 691 if (message_id < 0) |
| 692 return WebString(); | 692 return WebString(); |
| 693 return GetContentClient()->GetLocalizedString(message_id); | 693 return WebString::fromUTF16( |
| 694 GetContentClient()->GetLocalizedString(message_id)); |
| 694 } | 695 } |
| 695 | 696 |
| 696 WebString BlinkPlatformImpl::queryLocalizedString( | 697 WebString BlinkPlatformImpl::queryLocalizedString( |
| 697 WebLocalizedString::Name name, int numeric_value) { | 698 WebLocalizedString::Name name, int numeric_value) { |
| 698 return queryLocalizedString(name, base::IntToString16(numeric_value)); | 699 return queryLocalizedString( |
| 700 name, WebString::fromUTF16(base::IntToString16(numeric_value))); |
| 699 } | 701 } |
| 700 | 702 |
| 701 WebString BlinkPlatformImpl::queryLocalizedString( | 703 WebString BlinkPlatformImpl::queryLocalizedString( |
| 702 WebLocalizedString::Name name, const WebString& value) { | 704 WebLocalizedString::Name name, const WebString& value) { |
| 703 int message_id = ToMessageID(name); | 705 int message_id = ToMessageID(name); |
| 704 if (message_id < 0) | 706 if (message_id < 0) |
| 705 return WebString(); | 707 return WebString(); |
| 706 return base::ReplaceStringPlaceholders( | 708 return WebString::fromUTF16(base::ReplaceStringPlaceholders( |
| 707 GetContentClient()->GetLocalizedString(message_id), value, NULL); | 709 GetContentClient()->GetLocalizedString(message_id), value.utf16(), NULL)); |
| 708 } | 710 } |
| 709 | 711 |
| 710 WebString BlinkPlatformImpl::queryLocalizedString( | 712 WebString BlinkPlatformImpl::queryLocalizedString( |
| 711 WebLocalizedString::Name name, | 713 WebLocalizedString::Name name, |
| 712 const WebString& value1, | 714 const WebString& value1, |
| 713 const WebString& value2) { | 715 const WebString& value2) { |
| 714 int message_id = ToMessageID(name); | 716 int message_id = ToMessageID(name); |
| 715 if (message_id < 0) | 717 if (message_id < 0) |
| 716 return WebString(); | 718 return WebString(); |
| 717 std::vector<base::string16> values; | 719 std::vector<base::string16> values; |
| 718 values.reserve(2); | 720 values.reserve(2); |
| 719 values.push_back(value1); | 721 values.push_back(value1.utf16()); |
| 720 values.push_back(value2); | 722 values.push_back(value2.utf16()); |
| 721 return base::ReplaceStringPlaceholders( | 723 return WebString::fromUTF16(base::ReplaceStringPlaceholders( |
| 722 GetContentClient()->GetLocalizedString(message_id), values, NULL); | 724 GetContentClient()->GetLocalizedString(message_id), values, NULL)); |
| 723 } | 725 } |
| 724 | 726 |
| 725 blink::WebThread* BlinkPlatformImpl::compositorThread() const { | 727 blink::WebThread* BlinkPlatformImpl::compositorThread() const { |
| 726 return compositor_thread_; | 728 return compositor_thread_; |
| 727 } | 729 } |
| 728 | 730 |
| 729 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( | 731 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( |
| 730 blink::WebGestureDevice device_source, | 732 blink::WebGestureDevice device_source, |
| 731 const blink::WebFloatPoint& velocity, | 733 const blink::WebFloatPoint& velocity, |
| 732 const blink::WebSize& cumulative_scroll) { | 734 const blink::WebSize& cumulative_scroll) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 876 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 875 static_cast<ui::DomKey>(dom_key))); | 877 static_cast<ui::DomKey>(dom_key))); |
| 876 } | 878 } |
| 877 | 879 |
| 878 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 880 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 879 return static_cast<int>( | 881 return static_cast<int>( |
| 880 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 882 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 881 } | 883 } |
| 882 | 884 |
| 883 } // namespace content | 885 } // namespace content |
| OLD | NEW |