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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/process/process_metrics.h" | 21 #include "base/process/process_metrics.h" |
22 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
26 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" |
27 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "content/child/web_socket_stream_handle_impl.h" | 29 #include "content/child/web_socket_stream_handle_impl.h" |
30 #include "content/child/web_url_loader_impl.h" | 30 #include "content/child/web_url_loader_impl.h" |
31 #include "content/public/common/content_client.h" | |
32 #include "grit/blink_resources.h" | 31 #include "grit/blink_resources.h" |
33 #include "grit/webkit_resources.h" | 32 #include "grit/webkit_resources.h" |
34 #include "grit/webkit_strings.h" | 33 #include "grit/webkit_strings.h" |
35 #include "net/base/data_url.h" | 34 #include "net/base/data_url.h" |
36 #include "net/base/mime_util.h" | 35 #include "net/base/mime_util.h" |
37 #include "net/base/net_errors.h" | 36 #include "net/base/net_errors.h" |
38 #include "third_party/WebKit/public/platform/WebData.h" | 37 #include "third_party/WebKit/public/platform/WebData.h" |
39 #include "third_party/WebKit/public/platform/WebString.h" | 38 #include "third_party/WebKit/public/platform/WebString.h" |
40 #include "ui/base/layout.h" | 39 #include "ui/base/layout.h" |
41 #include "webkit/child/webkit_child_helpers.h" | 40 #include "webkit/child/webkit_child_helpers.h" |
| 41 #include "webkit/common/user_agent/user_agent.h" |
42 | 42 |
43 #if defined(OS_ANDROID) | 43 #if defined(OS_ANDROID) |
44 #include "base/android/sys_utils.h" | 44 #include "base/android/sys_utils.h" |
45 #endif | 45 #endif |
46 | 46 |
47 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) | 47 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) |
48 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 48 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
49 #endif | 49 #endif |
50 | 50 |
51 using blink::WebData; | 51 using blink::WebData; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 | 356 |
357 WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 357 WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
358 return new WebURLLoaderImpl(this); | 358 return new WebURLLoaderImpl(this); |
359 } | 359 } |
360 | 360 |
361 WebSocketStreamHandle* BlinkPlatformImpl::createSocketStreamHandle() { | 361 WebSocketStreamHandle* BlinkPlatformImpl::createSocketStreamHandle() { |
362 return new WebSocketStreamHandleImpl(this); | 362 return new WebSocketStreamHandleImpl(this); |
363 } | 363 } |
364 | 364 |
365 WebString BlinkPlatformImpl::userAgent() { | |
366 return WebString::fromUTF8(GetContentClient()->GetUserAgent()); | |
367 } | |
368 | |
369 WebString BlinkPlatformImpl::userAgent(const WebURL& url) { | 365 WebString BlinkPlatformImpl::userAgent(const WebURL& url) { |
370 return userAgent(); | 366 return WebString::fromUTF8(webkit_glue::GetUserAgent(url)); |
371 } | 367 } |
372 | 368 |
373 WebData BlinkPlatformImpl::parseDataURL( | 369 WebData BlinkPlatformImpl::parseDataURL( |
374 const WebURL& url, | 370 const WebURL& url, |
375 WebString& mimetype_out, | 371 WebString& mimetype_out, |
376 WebString& charset_out) { | 372 WebString& charset_out) { |
377 std::string mime_type, char_set, data; | 373 std::string mime_type, char_set, data; |
378 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) | 374 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) |
379 && net::IsSupportedMimeType(mime_type)) { | 375 && net::IsSupportedMimeType(mime_type)) { |
380 mimetype_out = WebString::fromUTF8(mime_type); | 376 mimetype_out = WebString::fromUTF8(mime_type); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 if (--shared_timer_suspended_ == 0 && | 902 if (--shared_timer_suspended_ == 0 && |
907 (!shared_timer_.IsRunning() || | 903 (!shared_timer_.IsRunning() || |
908 shared_timer_fire_time_was_set_while_suspended_)) { | 904 shared_timer_fire_time_was_set_while_suspended_)) { |
909 shared_timer_fire_time_was_set_while_suspended_ = false; | 905 shared_timer_fire_time_was_set_while_suspended_ = false; |
910 setSharedTimerFireInterval( | 906 setSharedTimerFireInterval( |
911 shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 907 shared_timer_fire_time_ - monotonicallyIncreasingTime()); |
912 } | 908 } |
913 } | 909 } |
914 | 910 |
915 } // namespace content | 911 } // namespace content |
OLD | NEW |