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

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

Issue 1401813002: Cache User Agent string in BlinkPlatformImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +comment. +DCHECK Created 5 years, 1 month 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
« no previous file with comments | « no previous file | content/public/common/content_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 child_thread ? child_thread->resource_dispatcher() : NULL, 480 child_thread ? child_thread->resource_dispatcher() : NULL,
481 make_scoped_ptr(new scheduler::WebTaskRunnerImpl( 481 make_scoped_ptr(new scheduler::WebTaskRunnerImpl(
482 base::ThreadTaskRunnerHandle::Get()))); 482 base::ThreadTaskRunnerHandle::Get())));
483 } 483 }
484 484
485 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { 485 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
486 return new WebSocketBridge; 486 return new WebSocketBridge;
487 } 487 }
488 488
489 WebString BlinkPlatformImpl::userAgent() { 489 WebString BlinkPlatformImpl::userAgent() {
490 return WebString::fromUTF8(GetContentClient()->GetUserAgent()); 490 CR_DEFINE_STATIC_LOCAL(
491 blink::WebString, user_agent,
492 (blink::WebString::fromUTF8(GetContentClient()->GetUserAgent())));
493 DCHECK(user_agent ==
494 blink::WebString::fromUTF8(GetContentClient()->GetUserAgent()));
495 return user_agent;
491 } 496 }
492 497
493 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url, 498 WebData BlinkPlatformImpl::parseDataURL(const WebURL& url,
494 WebString& mimetype_out, 499 WebString& mimetype_out,
495 WebString& charset_out) { 500 WebString& charset_out) {
496 std::string mime_type, char_set, data; 501 std::string mime_type, char_set, data;
497 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && 502 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) &&
498 mime_util::IsSupportedMimeType(mime_type)) { 503 mime_util::IsSupportedMimeType(mime_type)) {
499 mimetype_out = WebString::fromUTF8(mime_type); 504 mimetype_out = WebString::fromUTF8(mime_type);
500 charset_out = WebString::fromUTF8(char_set); 505 charset_out = WebString::fromUTF8(char_set);
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 1325 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
1321 static_cast<ui::DomKey>(dom_key))); 1326 static_cast<ui::DomKey>(dom_key)));
1322 } 1327 }
1323 1328
1324 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 1329 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
1325 return static_cast<int>( 1330 return static_cast<int>(
1326 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); 1331 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8()));
1327 } 1332 }
1328 1333
1329 } // namespace content 1334 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/common/content_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698