OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void DOMWindowFileSystem::webkitRequestFileSystem(DOMWindow& windowArg, int type
, long long size, FileSystemCallback* successCallback, ErrorCallback* errorCallb
ack) | 44 void DOMWindowFileSystem::webkitRequestFileSystem(DOMWindow& windowArg, int type
, long long size, FileSystemCallback* successCallback, ErrorCallback* errorCallb
ack) |
45 { | 45 { |
46 LocalDOMWindow& window = toLocalDOMWindow(windowArg); | 46 LocalDOMWindow& window = toLocalDOMWindow(windowArg); |
47 if (!window.isCurrentlyDisplayedInFrame()) | 47 if (!window.isCurrentlyDisplayedInFrame()) |
48 return; | 48 return; |
49 | 49 |
50 Document* document = window.document(); | 50 Document* document = window.document(); |
51 if (!document) | 51 if (!document) |
52 return; | 52 return; |
53 | 53 |
54 if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(document->securi
tyOrigin()->protocol())) | 54 if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(document->getSec
urityOrigin()->protocol())) |
55 UseCounter::count(document, UseCounter::RequestFileSystemNonWebbyOrigin)
; | 55 UseCounter::count(document, UseCounter::RequestFileSystemNonWebbyOrigin)
; |
56 | 56 |
57 if (!document->securityOrigin()->canAccessFileSystem()) { | 57 if (!document->getSecurityOrigin()->canAccessFileSystem()) { |
58 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::SECURITY_ERR)); | 58 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::SECURITY_ERR)); |
59 return; | 59 return; |
60 } | 60 } |
61 | 61 |
62 FileSystemType fileSystemType = static_cast<FileSystemType>(type); | 62 FileSystemType fileSystemType = static_cast<FileSystemType>(type); |
63 if (!DOMFileSystemBase::isValidType(fileSystemType)) { | 63 if (!DOMFileSystemBase::isValidType(fileSystemType)) { |
64 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::INVALID_MODIFICATION_ERR)); | 64 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::INVALID_MODIFICATION_ERR)); |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType
, size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi
leSystemType)); | 68 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType
, size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi
leSystemType)); |
69 } | 69 } |
70 | 70 |
71 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow& windowArg,
const String& url, EntryCallback* successCallback, ErrorCallback* errorCallback) | 71 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow& windowArg,
const String& url, EntryCallback* successCallback, ErrorCallback* errorCallback) |
72 { | 72 { |
73 LocalDOMWindow& window = toLocalDOMWindow(windowArg); | 73 LocalDOMWindow& window = toLocalDOMWindow(windowArg); |
74 if (!window.isCurrentlyDisplayedInFrame()) | 74 if (!window.isCurrentlyDisplayedInFrame()) |
75 return; | 75 return; |
76 | 76 |
77 Document* document = window.document(); | 77 Document* document = window.document(); |
78 if (!document) | 78 if (!document) |
79 return; | 79 return; |
80 | 80 |
81 SecurityOrigin* securityOrigin = document->securityOrigin(); | 81 SecurityOrigin* securityOrigin = document->getSecurityOrigin(); |
82 KURL completedURL = document->completeURL(url); | 82 KURL completedURL = document->completeURL(url); |
83 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co
mpletedURL)) { | 83 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co
mpletedURL)) { |
84 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::SECURITY_ERR)); | 84 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::SECURITY_ERR)); |
85 return; | 85 return; |
86 } | 86 } |
87 | 87 |
88 if (!completedURL.isValid()) { | 88 if (!completedURL.isValid()) { |
89 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::ENCODING_ERR)); | 89 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::ENCODING_ERR)); |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve
URICallbacks::create(successCallback, errorCallback, document)); | 93 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve
URICallbacks::create(successCallback, errorCallback, document)); |
94 } | 94 } |
95 | 95 |
96 static_assert(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<in
t>(FileSystemTypeTemporary), "DOMWindowFileSystem::TEMPORARY should match FileSy
stemTypeTemporary"); | 96 static_assert(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<in
t>(FileSystemTypeTemporary), "DOMWindowFileSystem::TEMPORARY should match FileSy
stemTypeTemporary"); |
97 static_assert(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<i
nt>(FileSystemTypePersistent), "DOMWindowFileSystem::PERSISTENT should match Fil
eSystemTypePersistent"); | 97 static_assert(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<i
nt>(FileSystemTypePersistent), "DOMWindowFileSystem::PERSISTENT should match Fil
eSystemTypePersistent"); |
98 | 98 |
99 } // namespace blink | 99 } // namespace blink |
OLD | NEW |