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 blink { | 41 namespace blink { |
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(LocalDOMWindow& window, int ty pe, long long size, FileSystemCallback* successCallback, ErrorCallback* errorCal lback) | 51 void DOMWindowFileSystem::webkitRequestFileSystem(DOMWindow& windowArg, int type , long long size, FileSystemCallback* successCallback, ErrorCallback* errorCallb ack) |
haraken
2014/11/08 09:17:25
Ditto.
| |
52 { | 52 { |
53 LocalDOMWindow& window = toLocalDOMWindow(windowArg); | |
53 if (!window.isCurrentlyDisplayedInFrame()) | 54 if (!window.isCurrentlyDisplayedInFrame()) |
54 return; | 55 return; |
55 | 56 |
56 Document* document = window.document(); | 57 Document* document = window.document(); |
57 if (!document) | 58 if (!document) |
58 return; | 59 return; |
59 | 60 |
60 if (!document->securityOrigin()->canAccessFileSystem()) { | 61 if (!document->securityOrigin()->canAccessFileSystem()) { |
61 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR)); | 62 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR)); |
62 return; | 63 return; |
63 } | 64 } |
64 | 65 |
65 FileSystemType fileSystemType = static_cast<FileSystemType>(type); | 66 FileSystemType fileSystemType = static_cast<FileSystemType>(type); |
66 if (!DOMFileSystemBase::isValidType(fileSystemType)) { | 67 if (!DOMFileSystemBase::isValidType(fileSystemType)) { |
67 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::INVALID_MODIFICATION_ERR)); | 68 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::INVALID_MODIFICATION_ERR)); |
68 return; | 69 return; |
69 } | 70 } |
70 | 71 |
71 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType , size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi leSystemType)); | 72 LocalFileSystem::from(*document)->requestFileSystem(document, fileSystemType , size, FileSystemCallbacks::create(successCallback, errorCallback, document, fi leSystemType)); |
72 } | 73 } |
73 | 74 |
74 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(LocalDOMWindow& window , const String& url, EntryCallback* successCallback, ErrorCallback* errorCallbac k) | 75 void DOMWindowFileSystem::webkitResolveLocalFileSystemURL(DOMWindow& windowArg, const String& url, EntryCallback* successCallback, ErrorCallback* errorCallback) |
haraken
2014/11/08 09:17:25
Ditto.
| |
75 { | 76 { |
77 LocalDOMWindow& window = toLocalDOMWindow(windowArg); | |
76 if (!window.isCurrentlyDisplayedInFrame()) | 78 if (!window.isCurrentlyDisplayedInFrame()) |
77 return; | 79 return; |
78 | 80 |
79 Document* document = window.document(); | 81 Document* document = window.document(); |
80 if (!document) | 82 if (!document) |
81 return; | 83 return; |
82 | 84 |
83 SecurityOrigin* securityOrigin = document->securityOrigin(); | 85 SecurityOrigin* securityOrigin = document->securityOrigin(); |
84 KURL completedURL = document->completeURL(url); | 86 KURL completedURL = document->completeURL(url); |
85 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) { | 87 if (!securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(co mpletedURL)) { |
86 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR)); | 88 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::SECURITY_ERR)); |
87 return; | 89 return; |
88 } | 90 } |
89 | 91 |
90 if (!completedURL.isValid()) { | 92 if (!completedURL.isValid()) { |
91 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::ENCODING_ERR)); | 93 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::crea te(FileError::ENCODING_ERR)); |
92 return; | 94 return; |
93 } | 95 } |
94 | 96 |
95 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve URICallbacks::create(successCallback, errorCallback, document)); | 97 LocalFileSystem::from(*document)->resolveURL(document, completedURL, Resolve URICallbacks::create(successCallback, errorCallback, document)); |
96 } | 98 } |
97 | 99 |
98 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<i nt>(FileSystemTypeTemporary), enum_mismatch); | 100 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); | 101 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast< int>(FileSystemTypePersistent), enum_mismatch); |
100 | 102 |
101 } // namespace blink | 103 } // namespace blink |
OLD | NEW |