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

Side by Side Diff: content/browser/service_worker/service_worker_context_wrapper.cc

Issue 1872673002: DevTools: introduce the bypass service worker checkbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_context_wrapper.h" 5 #include "content/browser/service_worker/service_worker_context_wrapper.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (!context_core_) { 284 if (!context_core_) {
285 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 285 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
286 base::Bind(callback, SERVICE_WORKER_ERROR_ABORT)); 286 base::Bind(callback, SERVICE_WORKER_ERROR_ABORT));
287 return; 287 return;
288 } 288 }
289 context_core_->storage()->FindRegistrationForPattern( 289 context_core_->storage()->FindRegistrationForPattern(
290 net::SimplifyUrlForRequest(pattern), 290 net::SimplifyUrlForRequest(pattern),
291 base::Bind(&StartActiveWorkerOnIO, callback)); 291 base::Bind(&StartActiveWorkerOnIO, callback));
292 } 292 }
293 293
294 void ServiceWorkerContextWrapper::SetForceUpdateOnPageLoad( 294 void ServiceWorkerContextWrapper::SetUpdateOnPageLoadForDevTools(
295 bool force_update_on_page_load) { 295 bool update_on_page_load) {
296 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 296 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
297 BrowserThread::PostTask( 297 BrowserThread::PostTask(
298 BrowserThread::IO, FROM_HERE, 298 BrowserThread::IO, FROM_HERE,
299 base::Bind(&ServiceWorkerContextWrapper::SetForceUpdateOnPageLoad, this, 299 base::Bind(&ServiceWorkerContextWrapper::SetUpdateOnPageLoadForDevTools,
300 force_update_on_page_load)); 300 this, update_on_page_load));
301 return; 301 return;
302 } 302 }
303 if (!context_core_) 303 if (!context_core_)
304 return; 304 return;
305 context_core_->set_force_update_on_page_load(force_update_on_page_load); 305 context_core_->set_update_on_page_load_for_devtools(update_on_page_load);
306 }
307
308 void ServiceWorkerContextWrapper::SetFallbackToNetworkForDevTools(
309 bool fallback_to_network) {
310 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
311 BrowserThread::PostTask(
312 BrowserThread::IO, FROM_HERE,
313 base::Bind(
314 &ServiceWorkerContextWrapper::SetFallbackToNetworkForDevTools, this,
315 fallback_to_network));
316 return;
317 }
318 if (!context_core_)
319 return;
320 context_core_->set_fallback_to_network_for_devtools(fallback_to_network);
306 } 321 }
307 322
308 void ServiceWorkerContextWrapper::GetAllOriginsInfo( 323 void ServiceWorkerContextWrapper::GetAllOriginsInfo(
309 const GetUsageInfoCallback& callback) { 324 const GetUsageInfoCallback& callback) {
310 DCHECK_CURRENTLY_ON(BrowserThread::IO); 325 DCHECK_CURRENTLY_ON(BrowserThread::IO);
311 if (!context_core_) { 326 if (!context_core_) {
312 BrowserThread::PostTask( 327 BrowserThread::PostTask(
313 BrowserThread::IO, 328 BrowserThread::IO,
314 FROM_HERE, 329 FROM_HERE,
315 base::Bind(callback, std::vector<ServiceWorkerUsageInfo>())); 330 base::Bind(callback, std::vector<ServiceWorkerUsageInfo>()));
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 observer_list_->Notify(FROM_HERE, 730 observer_list_->Notify(FROM_HERE,
716 &ServiceWorkerContextObserver::OnStorageWiped); 731 &ServiceWorkerContextObserver::OnStorageWiped);
717 } 732 }
718 733
719 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { 734 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() {
720 DCHECK_CURRENTLY_ON(BrowserThread::IO); 735 DCHECK_CURRENTLY_ON(BrowserThread::IO);
721 return context_core_.get(); 736 return context_core_.get();
722 } 737 }
723 738
724 } // namespace content 739 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698