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: Source/modules/filesystem/DOMWindowFileSystem.cpp

Issue 23537011: FileAPI: Add WebFileSystem::resolveURL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (!document) 80 if (!document)
81 return; 81 return;
82 82
83 SecurityOrigin* securityOrigin = document->securityOrigin(); 83 SecurityOrigin* securityOrigin = document->securityOrigin();
84 KURL completedURL = document->completeURL(url); 84 KURL completedURL = document->completeURL(url);
85 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) { 85 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) {
86 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR)); 86 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR));
87 return; 87 return;
88 } 88 }
89 89
90 FileSystemType type; 90 if (!completedURL.isValid()) {
91 String filePath;
92 if (!completedURL.isValid() || !DOMFileSystemBase::crackFileSystemURL(comple tedURL, type, filePath)) {
93 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::ENCODING_ERR)); 91 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::ENCODING_ERR));
94 return; 92 return;
95 } 93 }
96 94
97 LocalFileSystem::from(document)->readFileSystem(document, type, ResolveURICa llbacks::create(successCallback, errorCallback, document, type, filePath)); 95 LocalFileSystem::from(document)->resolveURL(document, completedURL, ResolveU RICallbacks::create(successCallback, errorCallback, document));
98 } 96 }
99 97
100 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<i nt>(FileSystemTypeTemporary), enum_mismatch); 98 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<i nt>(FileSystemTypeTemporary), enum_mismatch);
101 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast< int>(FileSystemTypePersistent), enum_mismatch); 99 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast< int>(FileSystemTypePersistent), enum_mismatch);
102 100
103 } // namespace WebCore 101 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorFileSystemAgent.cpp ('k') | Source/modules/filesystem/FileSystemCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698