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