jsbell | 5721760f | 2016-03-22 16:42:19 | [diff] [blame^] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "content/child/storage_util.h" |
| 6 | |
| 7 | #include "third_party/WebKit/public/platform/URLConversion.h" |
| 8 | #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 9 | #include "url/gurl.h" |
| 10 | |
| 11 | namespace content { |
| 12 | |
| 13 | GURL WebSecurityOriginToGURL(const blink::WebSecurityOrigin& security_origin) { |
| 14 | // "file:///" URLs navigated to by the user may have "isLocal" set, |
| 15 | // which stringify as "null" by default. Previous code that sent |
| 16 | // origins from Blink to Chromium via DatabaseIdentifier would ignore |
| 17 | // this, so we mimic that behavior here. |
| 18 | // TODO(jsbell): Eliminate this. https://crbug.com/591482 |
| 19 | if (security_origin.protocol().utf8() == "file" && |
| 20 | security_origin.host().utf8() == "" && security_origin.port() == 0) { |
| 21 | return GURL("file:///"); |
| 22 | } |
| 23 | return blink::WebStringToGURL(security_origin.toString()); |
| 24 | } |
| 25 | |
| 26 | } // namespace content |