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

Side by Side Diff: webkit/browser/fileapi/file_system_url.cc

Issue 336193003: Make FileSystemURL::ToGURL consistent with DOMFileSystemBase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: KURL Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/fileapi/file_system_url_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/browser/fileapi/file_system_url.h" 5 #include "webkit/browser/fileapi/file_system_url.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_util.h"
11 #include "net/base/escape.h"
10 #include "webkit/common/fileapi/file_system_types.h" 12 #include "webkit/common/fileapi/file_system_types.h"
11 #include "webkit/common/fileapi/file_system_util.h" 13 #include "webkit/common/fileapi/file_system_util.h"
12 14
13 namespace fileapi { 15 namespace fileapi {
14 16
15 namespace { 17 namespace {
16 18
17 } // namespace 19 } // namespace
18 20
19 FileSystemURL::FileSystemURL() 21 FileSystemURL::FileSystemURL()
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 FileSystemURL::~FileSystemURL() {} 80 FileSystemURL::~FileSystemURL() {}
79 81
80 GURL FileSystemURL::ToGURL() const { 82 GURL FileSystemURL::ToGURL() const {
81 if (!is_valid_) 83 if (!is_valid_)
82 return GURL(); 84 return GURL();
83 85
84 std::string url = GetFileSystemRootURI(origin_, mount_type_).spec(); 86 std::string url = GetFileSystemRootURI(origin_, mount_type_).spec();
85 if (url.empty()) 87 if (url.empty())
86 return GURL(); 88 return GURL();
87 89
88 url.append(virtual_path_.AsUTF8Unsafe()); 90 // Exactly match with DOMFileSystemBase::createFileSystemURL()'s encoding
91 // behavior, where the path is escaped by KURL::encodeWithURLEscapeSequences
92 // which is essentially encodeURIComponent except '/'.
93 std::string escaped = net::EscapeQueryParamValue(
94 virtual_path_.NormalizePathSeparatorsTo('/').AsUTF8Unsafe(),
95 false /* use_plus */);
96 ReplaceSubstringsAfterOffset(&escaped, 0, "%2F", "/");
97 url.append(escaped);
89 98
90 // Build nested GURL. 99 // Build nested GURL.
91 return GURL(url); 100 return GURL(url);
92 } 101 }
93 102
94 std::string FileSystemURL::DebugString() const { 103 std::string FileSystemURL::DebugString() const {
95 if (!is_valid_) 104 if (!is_valid_)
96 return "invalid filesystem: URL"; 105 return "invalid filesystem: URL";
97 std::ostringstream ss; 106 std::ostringstream ss;
98 ss << GetFileSystemRootURI(origin_, mount_type_); 107 ss << GetFileSystemRootURI(origin_, mount_type_);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (lhs.origin_ != rhs.origin_) 144 if (lhs.origin_ != rhs.origin_)
136 return lhs.origin_ < rhs.origin_; 145 return lhs.origin_ < rhs.origin_;
137 if (lhs.type_ != rhs.type_) 146 if (lhs.type_ != rhs.type_)
138 return lhs.type_ < rhs.type_; 147 return lhs.type_ < rhs.type_;
139 if (lhs.filesystem_id_ != rhs.filesystem_id_) 148 if (lhs.filesystem_id_ != rhs.filesystem_id_)
140 return lhs.filesystem_id_ < rhs.filesystem_id_; 149 return lhs.filesystem_id_ < rhs.filesystem_id_;
141 return lhs.path_ < rhs.path_; 150 return lhs.path_ < rhs.path_;
142 } 151 }
143 152
144 } // namespace fileapi 153 } // namespace fileapi
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_url_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698