| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 } // namespace | 298 } // namespace |
| 299 | 299 |
| 300 class ServiceWorkerInternalsUI::PartitionObserver | 300 class ServiceWorkerInternalsUI::PartitionObserver |
| 301 : public ServiceWorkerContextObserver { | 301 : public ServiceWorkerContextObserver { |
| 302 public: | 302 public: |
| 303 PartitionObserver(int partition_id, WebUI* web_ui) | 303 PartitionObserver(int partition_id, WebUI* web_ui) |
| 304 : partition_id_(partition_id), web_ui_(web_ui) {} | 304 : partition_id_(partition_id), web_ui_(web_ui) {} |
| 305 ~PartitionObserver() override {} | 305 ~PartitionObserver() override {} |
| 306 // ServiceWorkerContextObserver overrides: | 306 // ServiceWorkerContextObserver overrides: |
| 307 void OnRunningStateChanged(int64 version_id) override { | 307 void OnRunningStateChanged(int64 version_id, |
| 308 ServiceWorkerVersion::RunningStatus) override { |
| 308 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 309 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 309 web_ui_->CallJavascriptFunction( | 310 web_ui_->CallJavascriptFunction( |
| 310 "serviceworker.onRunningStateChanged", FundamentalValue(partition_id_), | 311 "serviceworker.onRunningStateChanged", FundamentalValue(partition_id_), |
| 311 StringValue(base::Int64ToString(version_id))); | 312 StringValue(base::Int64ToString(version_id))); |
| 312 } | 313 } |
| 313 void OnVersionStateChanged(int64 version_id) override { | 314 void OnVersionStateChanged(int64 version_id, |
| 315 ServiceWorkerVersion::Status) override { |
| 314 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 316 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 315 web_ui_->CallJavascriptFunction( | 317 web_ui_->CallJavascriptFunction( |
| 316 "serviceworker.onVersionStateChanged", | 318 "serviceworker.onVersionStateChanged", |
| 317 FundamentalValue(partition_id_), | 319 FundamentalValue(partition_id_), |
| 318 StringValue(base::Int64ToString(version_id))); | 320 StringValue(base::Int64ToString(version_id))); |
| 319 } | 321 } |
| 320 void OnErrorReported(int64 version_id, | 322 void OnErrorReported(int64 version_id, |
| 321 int process_id, | 323 int process_id, |
| 322 int thread_id, | 324 int thread_id, |
| 323 const ErrorInfo& info) override { | 325 const ErrorInfo& info) override { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 return; | 656 return; |
| 655 } | 657 } |
| 656 | 658 |
| 657 base::Callback<void(ServiceWorkerStatusCode)> callback = | 659 base::Callback<void(ServiceWorkerStatusCode)> callback = |
| 658 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); | 660 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); |
| 659 FindRegistrationForPattern( | 661 FindRegistrationForPattern( |
| 660 context, GURL(scope_string), base::Bind(StartActiveWorker, callback)); | 662 context, GURL(scope_string), base::Bind(StartActiveWorker, callback)); |
| 661 } | 663 } |
| 662 | 664 |
| 663 } // namespace content | 665 } // namespace content |
| OLD | NEW |