OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_internals_ui.h" | 5 #include "content/browser/service_worker/service_worker_internals_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 if (PartitionObserver* observer = | 493 if (PartitionObserver* observer = |
494 observers_.get(reinterpret_cast<uintptr_t>(partition))) { | 494 observers_.get(reinterpret_cast<uintptr_t>(partition))) { |
495 partition_id = observer->partition_id(); | 495 partition_id = observer->partition_id(); |
496 } else { | 496 } else { |
497 partition_id = next_partition_id_++; | 497 partition_id = next_partition_id_++; |
498 scoped_ptr<PartitionObserver> new_observer( | 498 scoped_ptr<PartitionObserver> new_observer( |
499 new PartitionObserver(partition_id, web_ui())); | 499 new PartitionObserver(partition_id, web_ui())); |
500 context->AddObserver(new_observer.get()); | 500 context->AddObserver(new_observer.get()); |
501 observers_.set(reinterpret_cast<uintptr_t>(partition), new_observer.Pass()); | 501 observers_.set(reinterpret_cast<uintptr_t>(partition), new_observer.Pass()); |
502 } | 502 } |
| 503 |
503 BrowserThread::PostTask( | 504 BrowserThread::PostTask( |
504 BrowserThread::IO, | 505 BrowserThread::IO, |
505 FROM_HERE, | 506 FROM_HERE, |
506 base::Bind(GetRegistrationsOnIOThread, | 507 base::Bind(GetRegistrationsOnIOThread, |
507 context, | 508 context, |
508 base::Bind(OnStoredRegistrations, | 509 base::Bind(OnStoredRegistrations, |
509 context, | 510 context, |
510 base::Bind(OnAllRegistrations, | 511 base::Bind(OnAllRegistrations, |
511 AsWeakPtr(), | 512 AsWeakPtr(), |
512 partition_id, | 513 partition_id, |
513 partition->GetPath())))); | 514 context->is_incognito() |
| 515 ? base::FilePath() |
| 516 : partition->GetPath())))); |
514 } | 517 } |
515 | 518 |
516 void ServiceWorkerInternalsUI::RemoveObserverFromStoragePartition( | 519 void ServiceWorkerInternalsUI::RemoveObserverFromStoragePartition( |
517 StoragePartition* partition) { | 520 StoragePartition* partition) { |
518 scoped_ptr<PartitionObserver> observer( | 521 scoped_ptr<PartitionObserver> observer( |
519 observers_.take_and_erase(reinterpret_cast<uintptr_t>(partition))); | 522 observers_.take_and_erase(reinterpret_cast<uintptr_t>(partition))); |
520 if (!observer.get()) | 523 if (!observer.get()) |
521 return; | 524 return; |
522 scoped_refptr<ServiceWorkerContextWrapper> context = | 525 scoped_refptr<ServiceWorkerContextWrapper> context = |
523 static_cast<ServiceWorkerContextWrapper*>( | 526 static_cast<ServiceWorkerContextWrapper*>( |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 return; | 669 return; |
667 } | 670 } |
668 | 671 |
669 base::Callback<void(ServiceWorkerStatusCode)> callback = | 672 base::Callback<void(ServiceWorkerStatusCode)> callback = |
670 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); | 673 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); |
671 FindRegistrationForPattern( | 674 FindRegistrationForPattern( |
672 context, GURL(scope_string), base::Bind(StartActiveWorker, callback)); | 675 context, GURL(scope_string), base::Bind(StartActiveWorker, callback)); |
673 } | 676 } |
674 | 677 |
675 } // namespace content | 678 } // namespace content |
OLD | NEW |