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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "content/child/push_messaging/push_provider.h" | 45 #include "content/child/push_messaging/push_provider.h" |
46 #include "content/child/thread_safe_sender.h" | 46 #include "content/child/thread_safe_sender.h" |
47 #include "content/child/web_url_loader_impl.h" | 47 #include "content/child/web_url_loader_impl.h" |
48 #include "content/child/web_url_request_util.h" | 48 #include "content/child/web_url_request_util.h" |
49 #include "content/child/worker_thread_registry.h" | 49 #include "content/child/worker_thread_registry.h" |
50 #include "content/public/common/content_client.h" | 50 #include "content/public/common/content_client.h" |
51 #include "content/public/common/service_manager_connection.h" | 51 #include "content/public/common/service_manager_connection.h" |
52 #include "net/base/net_errors.h" | 52 #include "net/base/net_errors.h" |
53 #include "third_party/WebKit/public/platform/WebData.h" | 53 #include "third_party/WebKit/public/platform/WebData.h" |
54 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 54 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 55 #include "third_party/WebKit/public/platform/WebGestureCurve.h" |
55 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 56 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
56 #include "third_party/WebKit/public/platform/WebString.h" | 57 #include "third_party/WebKit/public/platform/WebString.h" |
57 #include "third_party/WebKit/public/platform/WebURL.h" | 58 #include "third_party/WebKit/public/platform/WebURL.h" |
58 #include "third_party/WebKit/public/platform/scheduler/child/webthread_base.h" | 59 #include "third_party/WebKit/public/platform/scheduler/child/webthread_base.h" |
59 #include "third_party/zlib/google/compression_utils.h" | 60 #include "third_party/zlib/google/compression_utils.h" |
60 #include "ui/base/layout.h" | 61 #include "ui/base/layout.h" |
61 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 62 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
62 #include "ui/events/keycodes/dom/keycode_converter.h" | 63 #include "ui/events/keycodes/dom/keycode_converter.h" |
63 | 64 |
64 using blink::WebData; | 65 using blink::WebData; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 396 |
396 WebString BlinkPlatformImpl::UserAgent() { | 397 WebString BlinkPlatformImpl::UserAgent() { |
397 return blink::WebString::FromUTF8(GetContentClient()->GetUserAgent()); | 398 return blink::WebString::FromUTF8(GetContentClient()->GetUserAgent()); |
398 } | 399 } |
399 | 400 |
400 WebURLError BlinkPlatformImpl::CancelledError( | 401 WebURLError BlinkPlatformImpl::CancelledError( |
401 const WebURL& unreachableURL) const { | 402 const WebURL& unreachableURL) const { |
402 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); | 403 return CreateWebURLError(unreachableURL, false, net::ERR_ABORTED); |
403 } | 404 } |
404 | 405 |
405 blink::WebThread* BlinkPlatformImpl::CreateThread(const char* name) { | 406 std::unique_ptr<blink::WebThread> BlinkPlatformImpl::CreateThread( |
| 407 const char* name) { |
406 std::unique_ptr<blink::scheduler::WebThreadBase> thread = | 408 std::unique_ptr<blink::scheduler::WebThreadBase> thread = |
407 blink::scheduler::WebThreadBase::CreateWorkerThread( | 409 blink::scheduler::WebThreadBase::CreateWorkerThread( |
408 name, base::Thread::Options()); | 410 name, base::Thread::Options()); |
409 thread->Init(); | 411 thread->Init(); |
410 WaitUntilWebThreadTLSUpdate(thread.get()); | 412 WaitUntilWebThreadTLSUpdate(thread.get()); |
411 return thread.release(); | 413 return thread; |
412 } | 414 } |
413 | 415 |
414 void BlinkPlatformImpl::SetCompositorThread( | 416 void BlinkPlatformImpl::SetCompositorThread( |
415 blink::scheduler::WebThreadBase* compositor_thread) { | 417 blink::scheduler::WebThreadBase* compositor_thread) { |
416 compositor_thread_ = compositor_thread; | 418 compositor_thread_ = compositor_thread; |
417 if (compositor_thread_) | 419 if (compositor_thread_) |
418 WaitUntilWebThreadTLSUpdate(compositor_thread_); | 420 WaitUntilWebThreadTLSUpdate(compositor_thread_); |
419 } | 421 } |
420 | 422 |
421 blink::WebThread* BlinkPlatformImpl::CurrentThread() { | 423 blink::WebThread* BlinkPlatformImpl::CurrentThread() { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 values.push_back(value1.Utf16()); | 680 values.push_back(value1.Utf16()); |
679 values.push_back(value2.Utf16()); | 681 values.push_back(value2.Utf16()); |
680 return WebString::FromUTF16(base::ReplaceStringPlaceholders( | 682 return WebString::FromUTF16(base::ReplaceStringPlaceholders( |
681 GetContentClient()->GetLocalizedString(message_id), values, NULL)); | 683 GetContentClient()->GetLocalizedString(message_id), values, NULL)); |
682 } | 684 } |
683 | 685 |
684 blink::WebThread* BlinkPlatformImpl::CompositorThread() const { | 686 blink::WebThread* BlinkPlatformImpl::CompositorThread() const { |
685 return compositor_thread_; | 687 return compositor_thread_; |
686 } | 688 } |
687 | 689 |
688 blink::WebGestureCurve* BlinkPlatformImpl::CreateFlingAnimationCurve( | 690 std::unique_ptr<blink::WebGestureCurve> |
| 691 BlinkPlatformImpl::CreateFlingAnimationCurve( |
689 blink::WebGestureDevice device_source, | 692 blink::WebGestureDevice device_source, |
690 const blink::WebFloatPoint& velocity, | 693 const blink::WebFloatPoint& velocity, |
691 const blink::WebSize& cumulative_scroll) { | 694 const blink::WebSize& cumulative_scroll) { |
692 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( | 695 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( |
693 gfx::Vector2dF(velocity.x, velocity.y), | 696 gfx::Vector2dF(velocity.x, velocity.y), |
694 gfx::Vector2dF(cumulative_scroll.width, cumulative_scroll.height), | 697 gfx::Vector2dF(cumulative_scroll.width, cumulative_scroll.height), |
695 IsMainThread()).release(); | 698 IsMainThread()); |
696 } | 699 } |
697 | 700 |
698 void BlinkPlatformImpl::DidStartWorkerThread() { | 701 void BlinkPlatformImpl::DidStartWorkerThread() { |
699 WorkerThreadRegistry::Instance()->DidStartCurrentWorkerThread(); | 702 WorkerThreadRegistry::Instance()->DidStartCurrentWorkerThread(); |
700 } | 703 } |
701 | 704 |
702 void BlinkPlatformImpl::WillStopWorkerThread() { | 705 void BlinkPlatformImpl::WillStopWorkerThread() { |
703 WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); | 706 WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); |
704 } | 707 } |
705 | 708 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 WebString BlinkPlatformImpl::DomKeyStringFromEnum(int dom_key) { | 829 WebString BlinkPlatformImpl::DomKeyStringFromEnum(int dom_key) { |
827 return WebString::FromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 830 return WebString::FromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
828 static_cast<ui::DomKey>(dom_key))); | 831 static_cast<ui::DomKey>(dom_key))); |
829 } | 832 } |
830 | 833 |
831 int BlinkPlatformImpl::DomKeyEnumFromString(const WebString& key_string) { | 834 int BlinkPlatformImpl::DomKeyEnumFromString(const WebString& key_string) { |
832 return static_cast<int>( | 835 return static_cast<int>( |
833 ui::KeycodeConverter::KeyStringToDomKey(key_string.Utf8())); | 836 ui::KeycodeConverter::KeyStringToDomKey(key_string.Utf8())); |
834 } | 837 } |
835 | 838 |
836 blink::WebFeaturePolicy* BlinkPlatformImpl::CreateFeaturePolicy( | 839 std::unique_ptr<blink::WebFeaturePolicy> BlinkPlatformImpl::CreateFeaturePolicy( |
837 const blink::WebFeaturePolicy* parent_policy, | 840 const blink::WebFeaturePolicy* parent_policy, |
838 const blink::WebParsedFeaturePolicy& container_policy, | 841 const blink::WebParsedFeaturePolicy& container_policy, |
839 const blink::WebParsedFeaturePolicy& policy_header, | 842 const blink::WebParsedFeaturePolicy& policy_header, |
840 const blink::WebSecurityOrigin& origin) { | 843 const blink::WebSecurityOrigin& origin) { |
841 std::unique_ptr<FeaturePolicy> policy = FeaturePolicy::CreateFromParentPolicy( | 844 std::unique_ptr<FeaturePolicy> policy = FeaturePolicy::CreateFromParentPolicy( |
842 static_cast<const FeaturePolicy*>(parent_policy), | 845 static_cast<const FeaturePolicy*>(parent_policy), |
843 FeaturePolicyHeaderFromWeb(container_policy), url::Origin(origin)); | 846 FeaturePolicyHeaderFromWeb(container_policy), url::Origin(origin)); |
844 policy->SetHeaderPolicy(FeaturePolicyHeaderFromWeb(policy_header)); | 847 policy->SetHeaderPolicy(FeaturePolicyHeaderFromWeb(policy_header)); |
845 return policy.release(); | 848 return policy; |
846 } | 849 } |
847 | 850 |
848 blink::WebFeaturePolicy* BlinkPlatformImpl::DuplicateFeaturePolicyWithOrigin( | 851 std::unique_ptr<blink::WebFeaturePolicy> |
| 852 BlinkPlatformImpl::DuplicateFeaturePolicyWithOrigin( |
849 const blink::WebFeaturePolicy& policy, | 853 const blink::WebFeaturePolicy& policy, |
850 const blink::WebSecurityOrigin& new_origin) { | 854 const blink::WebSecurityOrigin& new_origin) { |
851 std::unique_ptr<FeaturePolicy> new_policy = | 855 std::unique_ptr<FeaturePolicy> new_policy = |
852 FeaturePolicy::CreateFromPolicyWithOrigin( | 856 FeaturePolicy::CreateFromPolicyWithOrigin( |
853 static_cast<const FeaturePolicy&>(policy), url::Origin(new_origin)); | 857 static_cast<const FeaturePolicy&>(policy), url::Origin(new_origin)); |
854 return new_policy.release(); | 858 return new_policy; |
855 } | 859 } |
856 | 860 |
857 } // namespace content | 861 } // namespace content |
OLD | NEW |