From f894ed6831d28e6a02f2474ed9cc746754d517a1 Mon Sep 17 00:00:00 2001 From: "hidehiko@chromium.org" Date: Mon, 26 Aug 2013 13:27:20 +0000 Subject: Adds ToGURL to FileSystemURL. FileSystemURL has enough information to reconstruct the GURL instance, but there is no utility method. This adds the method. It will be used to implement, e.g., new file system private API on Chrome OS. BUG=278040 TEST=Ran content_unittests Review URL: https://chromiumcodereview.appspot.com/22891022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219542 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/browser/fileapi/file_system_url.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'webkit/browser/fileapi/file_system_url.cc') diff --git a/webkit/browser/fileapi/file_system_url.cc b/webkit/browser/fileapi/file_system_url.cc index 6269296..930ec16 100644 --- a/webkit/browser/fileapi/file_system_url.cc +++ b/webkit/browser/fileapi/file_system_url.cc @@ -135,6 +135,20 @@ FileSystemURL::FileSystemURL(const GURL& origin, FileSystemURL::~FileSystemURL() {} +GURL FileSystemURL::ToGURL() const { + if (!is_valid_) + return GURL(); + + std::string url = GetFileSystemRootURI(origin_, mount_type_).spec(); + if (url.empty()) + return GURL(); + + url.append(virtual_path_.AsUTF8Unsafe()); + + // Build nested GURL. + return GURL(url); +} + std::string FileSystemURL::DebugString() const { if (!is_valid_) return "invalid filesystem: URL"; -- cgit v1.1