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

Side by Side Diff: third_party/WebKit/Source/core/exported/SharedWorkerRepositoryClientImpl.cpp

Issue 2881073003: Support DataSaver for SharedWorker (Closed)
Patch Set: same as PS6 Created 3 years, 7 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 16 matching lines...) Expand all
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 "core/exported/SharedWorkerRepositoryClientImpl.h" 31 #include "core/exported/SharedWorkerRepositoryClientImpl.h"
32 32
33 #include <memory> 33 #include <memory>
34 #include <utility> 34 #include <utility>
35 #include "core/dom/ExecutionContext.h" 35 #include "core/dom/ExecutionContext.h"
36 #include "core/events/Event.h" 36 #include "core/events/Event.h"
37 #include "core/frame/Settings.h"
37 #include "core/frame/UseCounter.h" 38 #include "core/frame/UseCounter.h"
38 #include "core/frame/csp/ContentSecurityPolicy.h" 39 #include "core/frame/csp/ContentSecurityPolicy.h"
39 #include "core/probe/CoreProbes.h" 40 #include "core/probe/CoreProbes.h"
40 #include "core/workers/SharedWorker.h" 41 #include "core/workers/SharedWorker.h"
41 #include "platform/loader/fetch/ResourceResponse.h" 42 #include "platform/loader/fetch/ResourceResponse.h"
42 #include "platform/wtf/PtrUtil.h" 43 #include "platform/wtf/PtrUtil.h"
43 #include "public/platform/WebContentSecurityPolicy.h" 44 #include "public/platform/WebContentSecurityPolicy.h"
44 #include "public/platform/WebMessagePortChannel.h" 45 #include "public/platform/WebMessagePortChannel.h"
45 #include "public/platform/WebString.h" 46 #include "public/platform/WebString.h"
46 #include "public/platform/WebURL.h" 47 #include "public/platform/WebURL.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 138 }
138 139
139 bool is_secure_context = worker->GetExecutionContext()->IsSecureContext(); 140 bool is_secure_context = worker->GetExecutionContext()->IsSecureContext();
140 std::unique_ptr<WebSharedWorkerConnectListener> listener = 141 std::unique_ptr<WebSharedWorkerConnectListener> listener =
141 WTF::MakeUnique<SharedWorkerConnectListener>(worker); 142 WTF::MakeUnique<SharedWorkerConnectListener>(worker);
142 client_->Connect( 143 client_->Connect(
143 url, name, GetId(document), header, header_type, 144 url, name, GetId(document), header, header_type,
144 worker->GetExecutionContext()->GetSecurityContext().AddressSpace(), 145 worker->GetExecutionContext()->GetSecurityContext().AddressSpace(),
145 is_secure_context ? kWebSharedWorkerCreationContextTypeSecure 146 is_secure_context ? kWebSharedWorkerCreationContextTypeSecure
146 : kWebSharedWorkerCreationContextTypeNonsecure, 147 : kWebSharedWorkerCreationContextTypeNonsecure,
148 document->GetFrame()->GetSettings()->GetDataSaverEnabled(),
147 std::move(port), std::move(listener)); 149 std::move(port), std::move(listener));
148 } 150 }
149 151
150 void SharedWorkerRepositoryClientImpl::DocumentDetached(Document* document) { 152 void SharedWorkerRepositoryClientImpl::DocumentDetached(Document* document) {
151 DCHECK(client_); 153 DCHECK(client_);
152 client_->DocumentDetached(GetId(document)); 154 client_->DocumentDetached(GetId(document));
153 } 155 }
154 156
155 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl( 157 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl(
156 WebSharedWorkerRepositoryClient* client) 158 WebSharedWorkerRepositoryClient* client)
157 : client_(client) {} 159 : client_(client) {}
158 160
159 } // namespace blink 161 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698