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

Side by Side Diff: webkit/database/database_util.cc

Issue 10572006: Fix GetOriginURLFromIdentifier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch to using isUnique. Created 8 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 | « no previous file | webkit/fileapi/file_system_util.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/database/database_util.h" 5 #include "webkit/database/database_util.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
10 #include "webkit/database/database_tracker.h" 10 #include "webkit/database/database_tracker.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return FilePath(); 68 return FilePath();
69 return full_path; 69 return full_path;
70 } 70 }
71 71
72 string16 DatabaseUtil::GetOriginIdentifier(const GURL& url) { 72 string16 DatabaseUtil::GetOriginIdentifier(const GURL& url) {
73 string16 spec = UTF8ToUTF16(url.spec()); 73 string16 spec = UTF8ToUTF16(url.spec());
74 return WebKit::WebSecurityOrigin::createFromString(spec).databaseIdentifier(); 74 return WebKit::WebSecurityOrigin::createFromString(spec).databaseIdentifier();
75 } 75 }
76 76
77 GURL DatabaseUtil::GetOriginFromIdentifier(const string16& origin_identifier) { 77 GURL DatabaseUtil::GetOriginFromIdentifier(const string16& origin_identifier) {
78 GURL origin(WebKit::WebSecurityOrigin::createFromDatabaseIdentifier( 78 WebKit::WebSecurityOrigin web_security_origin =
79 origin_identifier).toString()); 79 WebKit::WebSecurityOrigin::createFromDatabaseIdentifier(
80 origin_identifier);
81
80 // We need this work-around for file:/// URIs as 82 // We need this work-around for file:/// URIs as
81 // createFromDatabaseIdentifier returns empty origin url for them. 83 // createFromDatabaseIdentifier returns null origin_url for them.
82 if (origin.spec().empty() && 84 if (web_security_origin.isUnique()) {
83 origin_identifier.find(ASCIIToUTF16("file__")) == 0) 85 if (origin_identifier.find(UTF8ToUTF16("file__")) == 0)
84 return GURL("file:///"); 86 return GURL("file:///");
85 return origin; 87 return GURL();
88 }
89
90 return GURL(web_security_origin.toString());
86 } 91 }
87 92
88 } // namespace webkit_database 93 } // namespace webkit_database
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698