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 "mojo/services/html_viewer/blink_platform_impl.h" | 5 #include "mojo/services/html_viewer/blink_platform_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "mojo/services/html_viewer/blink_resource_constants.h" | 15 #include "mojo/services/html_viewer/blink_resource_constants.h" |
16 #include "mojo/services/html_viewer/webthread_impl.h" | 16 #include "mojo/services/html_viewer/webthread_impl.h" |
17 #include "net/base/data_url.h" | 17 #include "net/base/data_url.h" |
18 #include "net/base/mime_util.h" | 18 #include "net/base/mime_util.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
21 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 21 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 22 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
22 | 23 |
23 namespace html_viewer { | 24 namespace html_viewer { |
24 namespace { | 25 namespace { |
25 | 26 |
26 // Allows overriding user agent scring. | 27 // Allows overriding user agent scring. |
27 const char kUserAgentSwitch[] = "user-agent"; | 28 const char kUserAgentSwitch[] = "user-agent"; |
28 | 29 |
29 // TODO(darin): Figure out what our UA should really be. | 30 // TODO(darin): Figure out what our UA should really be. |
30 const char kDefaultUserAgentString[] = | 31 const char kDefaultUserAgentString[] = |
31 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) " | 32 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) " |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 const blink::WebVector<blink::WebWaitableEvent*>& web_events) { | 251 const blink::WebVector<blink::WebWaitableEvent*>& web_events) { |
251 std::vector<base::WaitableEvent*> events; | 252 std::vector<base::WaitableEvent*> events; |
252 for (size_t i = 0; i < web_events.size(); ++i) | 253 for (size_t i = 0; i < web_events.size(); ++i) |
253 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl()); | 254 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl()); |
254 size_t idx = base::WaitableEvent::WaitMany( | 255 size_t idx = base::WaitableEvent::WaitMany( |
255 vector_as_array(&events), events.size()); | 256 vector_as_array(&events), events.size()); |
256 DCHECK_LT(idx, web_events.size()); | 257 DCHECK_LT(idx, web_events.size()); |
257 return web_events[idx]; | 258 return web_events[idx]; |
258 } | 259 } |
259 | 260 |
| 261 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( |
| 262 blink::WebGestureDevice device_source, |
| 263 const blink::WebFloatPoint& velocity, |
| 264 const blink::WebSize& cumulative_scroll) { |
| 265 const bool is_main_thread = true; |
| 266 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( |
| 267 gfx::Vector2dF(velocity.x, velocity.y), |
| 268 gfx::Vector2dF(cumulative_scroll.width, cumulative_scroll.height), |
| 269 is_main_thread).release(); |
| 270 } |
| 271 |
260 // static | 272 // static |
261 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 273 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
262 WebThreadImplForMessageLoop* impl = | 274 WebThreadImplForMessageLoop* impl = |
263 static_cast<WebThreadImplForMessageLoop*>(thread); | 275 static_cast<WebThreadImplForMessageLoop*>(thread); |
264 delete impl; | 276 delete impl; |
265 } | 277 } |
266 | 278 |
267 } // namespace html_viewer | 279 } // namespace html_viewer |
OLD | NEW |