Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 186883002: Move user_agent code from webkit/ to content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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/user_agent.h"
31 #include "grit/blink_resources.h" 32 #include "grit/blink_resources.h"
32 #include "grit/webkit_resources.h" 33 #include "grit/webkit_resources.h"
33 #include "grit/webkit_strings.h" 34 #include "grit/webkit_strings.h"
34 #include "net/base/data_url.h" 35 #include "net/base/data_url.h"
35 #include "net/base/mime_util.h" 36 #include "net/base/mime_util.h"
36 #include "net/base/net_errors.h" 37 #include "net/base/net_errors.h"
37 #include "third_party/WebKit/public/platform/WebData.h" 38 #include "third_party/WebKit/public/platform/WebData.h"
38 #include "third_party/WebKit/public/platform/WebString.h" 39 #include "third_party/WebKit/public/platform/WebString.h"
39 #include "ui/base/layout.h" 40 #include "ui/base/layout.h"
40 #include "webkit/child/webkit_child_helpers.h" 41 #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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(const WebURL& url) { 365 WebString BlinkPlatformImpl::userAgent(const WebURL& url) {
366 return WebString::fromUTF8(webkit_glue::GetUserAgent(url)); 366 return WebString::fromUTF8(GetUserAgent(url));
367 } 367 }
368 368
369 WebData BlinkPlatformImpl::parseDataURL( 369 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url,
370 const WebURL& url, 370 WebString& mimetype_out,
371 WebString& mimetype_out, 371 WebString& charset_out) {
372 WebString& charset_out) {
373 std::string mime_type, char_set, data; 372 std::string mime_type, char_set, data;
374 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) 373 if (net::DataURL::Parse(url, &mime_type, &char_set, &data)
375 && net::IsSupportedMimeType(mime_type)) { 374 && net::IsSupportedMimeType(mime_type)) {
376 mimetype_out = WebString::fromUTF8(mime_type); 375 mimetype_out = WebString::fromUTF8(mime_type);
377 charset_out = WebString::fromUTF8(char_set); 376 charset_out = WebString::fromUTF8(char_set);
378 return data; 377 return data;
379 } 378 }
380 return WebData(); 379 return WebData();
381 } 380 }
382 381
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 if (--shared_timer_suspended_ == 0 && 908 if (--shared_timer_suspended_ == 0 &&
910 (!shared_timer_.IsRunning() || 909 (!shared_timer_.IsRunning() ||
911 shared_timer_fire_time_was_set_while_suspended_)) { 910 shared_timer_fire_time_was_set_while_suspended_)) {
912 shared_timer_fire_time_was_set_while_suspended_ = false; 911 shared_timer_fire_time_was_set_while_suspended_ = false;
913 setSharedTimerFireInterval( 912 setSharedTimerFireInterval(
914 shared_timer_fire_time_ - monotonicallyIncreasingTime()); 913 shared_timer_fire_time_ - monotonicallyIncreasingTime());
915 } 914 }
916 } 915 }
917 916
918 } // namespace content 917 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698