| OLD | NEW |
| 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 |
| OLD | NEW |