blob: 6e440bf96e82347bfd2a961d01d4fef1fe736ee1 [file] [log] [blame]
jsbell5721760f2016-03-22 16:42:191// 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
11namespace content {
12
13GURL 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