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

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

Issue 2382973002: Convert WebSecurityOrigin -> GURL without re-parsing the url (Closed)
Patch Set: rebase on #427122 Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/storage_util.h" 5 #include "content/child/storage_util.h"
6 6
7 #include "third_party/WebKit/public/platform/URLConversion.h" 7 #include "third_party/WebKit/public/platform/URLConversion.h"
8 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 8 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 #include "url/origin.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 GURL WebSecurityOriginToGURL(const blink::WebSecurityOrigin& security_origin) { 14 GURL WebSecurityOriginToGURL(const blink::WebSecurityOrigin& security_origin) {
14 // "file:///" URLs navigated to by the user may have "isLocal" set, 15 // "file:///" URLs navigated to by the user may have "isLocal" set,
15 // which stringify as "null" by default. Previous code that sent 16 // which stringify as "null" by default. Previous code that sent
16 // origins from Blink to Chromium via DatabaseIdentifier would ignore 17 // origins from Blink to Chromium via DatabaseIdentifier would ignore
17 // this, so we mimic that behavior here. 18 // this, so we mimic that behavior here.
18 // TODO(jsbell): Eliminate this. https://crbug.com/591482 19 // TODO(jsbell): Eliminate this. https://crbug.com/591482
19 if (security_origin.protocol().utf8() == "file" && 20 if (security_origin.protocol().utf8() == "file" &&
20 security_origin.host().utf8() == "" && security_origin.port() == 0) { 21 security_origin.host().utf8() == "" && security_origin.port() == 0) {
21 return GURL("file:///"); 22 return GURL("file:///");
22 } 23 }
23 return blink::WebStringToGURL(security_origin.toString()); 24 return url::Origin(security_origin).GetURL();
24 } 25 }
25 26
26 } // namespace content 27 } // namespace content
OLDNEW
« no previous file with comments | « content/child/notifications/notification_manager.cc ('k') | content/renderer/dom_storage/local_storage_namespace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698