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 30 matching lines...) Expand all Loading... |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 DOMWindowFileSystem::DOMWindowFileSystem() | 43 DOMWindowFileSystem::DOMWindowFileSystem() |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 DOMWindowFileSystem::~DOMWindowFileSystem() | 47 DOMWindowFileSystem::~DOMWindowFileSystem() |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 void DOMWindowFileSystem::webkitRequestFileSystem(DOMWindow* window, int type, l
ong long size, PassOwnPtr<FileSystemCallback> successCallback, PassOwnPtr<ErrorC
allback> errorCallback) | 51 void DOMWindowFileSystem::webkitRequestFileSystem(DOMWindow& window, int type, l
ong long size, PassOwnPtr<FileSystemCallback> successCallback, PassOwnPtr<ErrorC
allback> errorCallback) |
52 { | 52 { |
53 if (!window->isCurrentlyDisplayedInFrame()) | 53 if (!window.isCurrentlyDisplayedInFrame()) |
54 return; | 54 return; |
55 | 55 |
56 Document* document = window->document(); | 56 Document* document = window.document(); |
57 if (!document) | 57 if (!document) |
58 return; | 58 return; |
59 | 59 |
60 if (!document->securityOrigin()->canAccessFileSystem()) { | 60 if (!document->securityOrigin()->canAccessFileSystem()) { |
61 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::SECURITY_ERR)); | 61 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::SECURITY_ERR)); |
62 return; | 62 return; |
63 } | 63 } |
64 | 64 |
65 FileSystemType fileSystemType = static_cast<FileSystemType>(type); | 65 FileSystemType fileSystemType = static_cast<FileSystemType>(type); |
66 if (!DOMFileSystemBase::isValidType(fileSystemType)) { | 66 if (!DOMFileSystemBase::isValidType(fileSystemType)) { |
67 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::INVALID_MODIFICATION_ERR)); | 67 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::INVALID_MODIFICATION_ERR)); |
68 return; | 68 return; |
69 } | 69 } |
70 | 70 |
71 LocalFileSystem::from(document)->requestFileSystem(document, fileSystemType,
size, FileSystemCallbacks::create(successCallback, errorCallback, document, fil
eSystemType)); | 71 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType
, size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi
leSystemType)); |
72 } | 72 } |
73 | 73 |
74 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow* window, con
st String& url, PassOwnPtr<EntryCallback> successCallback, PassOwnPtr<ErrorCallb
ack> errorCallback) | 74 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow& window, con
st String& url, PassOwnPtr<EntryCallback> successCallback, PassOwnPtr<ErrorCallb
ack> errorCallback) |
75 { | 75 { |
76 if (!window->isCurrentlyDisplayedInFrame()) | 76 if (!window.isCurrentlyDisplayedInFrame()) |
77 return; | 77 return; |
78 | 78 |
79 Document* document = window->document(); | 79 Document* document = window.document(); |
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 if (!completedURL.isValid()) { | 90 if (!completedURL.isValid()) { |
91 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::ENCODING_ERR)); | 91 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea
te(FileError::ENCODING_ERR)); |
92 return; | 92 return; |
93 } | 93 } |
94 | 94 |
95 LocalFileSystem::from(document)->resolveURL(document, completedURL, ResolveU
RICallbacks::create(successCallback, errorCallback, document)); | 95 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve
URICallbacks::create(successCallback, errorCallback, document)); |
96 } | 96 } |
97 | 97 |
98 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); |
99 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); |
100 | 100 |
101 } // namespace WebCore | 101 } // namespace WebCore |
OLD | NEW |