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

Side by Side Diff: third_party/WebKit/Source/web/LocalFileSystemClient.cpp

Issue 2786673002: Separate ContentSettingsClient out from LocalFrameClient (Closed)
Patch Set: added class-level comment Created 3 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/LocalFileSystemClient.h" 31 #include "web/LocalFileSystemClient.h"
32 32
33 #include <memory>
33 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/frame/ContentSettingsClient.h"
34 #include "core/workers/WorkerGlobalScope.h" 36 #include "core/workers/WorkerGlobalScope.h"
35 #include "platform/ContentSettingCallbacks.h" 37 #include "platform/ContentSettingCallbacks.h"
36 #include "platform/weborigin/SecurityOrigin.h" 38 #include "platform/weborigin/SecurityOrigin.h"
37 #include "public/platform/WebContentSettingCallbacks.h"
38 #include "public/web/WebContentSettingsClient.h"
39 #include "web/WebLocalFrameImpl.h" 39 #include "web/WebLocalFrameImpl.h"
40 #include "web/WorkerContentSettingsClient.h" 40 #include "web/WorkerContentSettingsClient.h"
41 #include "wtf/PtrUtil.h" 41 #include "wtf/PtrUtil.h"
42 #include "wtf/text/WTFString.h" 42 #include "wtf/text/WTFString.h"
43 #include <memory>
44 43
45 namespace blink { 44 namespace blink {
46 45
47 std::unique_ptr<FileSystemClient> LocalFileSystemClient::create() { 46 std::unique_ptr<FileSystemClient> LocalFileSystemClient::create() {
48 return WTF::wrapUnique( 47 return WTF::wrapUnique(
49 static_cast<FileSystemClient*>(new LocalFileSystemClient())); 48 static_cast<FileSystemClient*>(new LocalFileSystemClient()));
50 } 49 }
51 50
52 LocalFileSystemClient::~LocalFileSystemClient() {} 51 LocalFileSystemClient::~LocalFileSystemClient() {}
53 52
(...skipping 13 matching lines...) Expand all
67 void LocalFileSystemClient::requestFileSystemAccessAsync( 66 void LocalFileSystemClient::requestFileSystemAccessAsync(
68 ExecutionContext* context, 67 ExecutionContext* context,
69 std::unique_ptr<ContentSettingCallbacks> callbacks) { 68 std::unique_ptr<ContentSettingCallbacks> callbacks) {
70 DCHECK(context); 69 DCHECK(context);
71 if (!context->isDocument()) { 70 if (!context->isDocument()) {
72 NOTREACHED(); 71 NOTREACHED();
73 return; 72 return;
74 } 73 }
75 74
76 Document* document = toDocument(context); 75 Document* document = toDocument(context);
77 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->frame()); 76 DCHECK(document->frame());
78 if (!webFrame->contentSettingsClient()) { 77 document->frame()->contentSettingsClient()->requestFileSystemAccessAsync(
79 callbacks->onAllowed();
80 return;
81 }
82 webFrame->contentSettingsClient()->requestFileSystemAccessAsync(
83 std::move(callbacks)); 78 std::move(callbacks));
84 } 79 }
85 80
86 LocalFileSystemClient::LocalFileSystemClient() {} 81 LocalFileSystemClient::LocalFileSystemClient() {}
87 82
88 } // namespace blink 83 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/IndexedDBClientImpl.cpp ('k') | third_party/WebKit/Source/web/LocalFrameClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698