| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 313 | 313 | 
| 314 }  // namespace | 314 }  // namespace | 
| 315 | 315 | 
| 316 class ServiceWorkerInternalsUI::PartitionObserver | 316 class ServiceWorkerInternalsUI::PartitionObserver | 
| 317     : public ServiceWorkerContextObserver { | 317     : public ServiceWorkerContextObserver { | 
| 318  public: | 318  public: | 
| 319   PartitionObserver(int partition_id, WebUI* web_ui) | 319   PartitionObserver(int partition_id, WebUI* web_ui) | 
| 320       : partition_id_(partition_id), web_ui_(web_ui) {} | 320       : partition_id_(partition_id), web_ui_(web_ui) {} | 
| 321   ~PartitionObserver() override {} | 321   ~PartitionObserver() override {} | 
| 322   // ServiceWorkerContextObserver overrides: | 322   // ServiceWorkerContextObserver overrides: | 
| 323   void OnRunningStateChanged(int64 version_id, | 323   void OnRunningStateChanged( | 
| 324                              ServiceWorkerVersion::RunningStatus) override { | 324       int64 version_id, | 
|  | 325       content::ServiceWorkerVersion::RunningStatus running_status, | 
|  | 326       int process_id, | 
|  | 327       int thread_id, | 
|  | 328       int devtools_agent_route_id) override { | 
| 325     DCHECK_CURRENTLY_ON(BrowserThread::UI); | 329     DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
| 326     web_ui_->CallJavascriptFunction( | 330     web_ui_->CallJavascriptFunction( | 
| 327         "serviceworker.onRunningStateChanged", FundamentalValue(partition_id_), | 331         "serviceworker.onRunningStateChanged", FundamentalValue(partition_id_), | 
| 328         StringValue(base::Int64ToString(version_id))); | 332         StringValue(base::Int64ToString(version_id))); | 
| 329   } | 333   } | 
| 330   void OnVersionStateChanged(int64 version_id, | 334   void OnVersionStateChanged(int64 version_id, | 
| 331                              ServiceWorkerVersion::Status) override { | 335                              ServiceWorkerVersion::Status) override { | 
| 332     DCHECK_CURRENTLY_ON(BrowserThread::UI); | 336     DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
| 333     web_ui_->CallJavascriptFunction( | 337     web_ui_->CallJavascriptFunction( | 
| 334         "serviceworker.onVersionStateChanged", | 338         "serviceworker.onVersionStateChanged", | 
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 663       !GetServiceWorkerContext(partition_id, &context) || | 667       !GetServiceWorkerContext(partition_id, &context) || | 
| 664       !cmd_args->GetString("scope", &scope_string)) { | 668       !cmd_args->GetString("scope", &scope_string)) { | 
| 665     return; | 669     return; | 
| 666   } | 670   } | 
| 667   base::Callback<void(ServiceWorkerStatusCode)> callback = | 671   base::Callback<void(ServiceWorkerStatusCode)> callback = | 
| 668       base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); | 672       base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); | 
| 669   context->StartServiceWorker(GURL(scope_string), callback); | 673   context->StartServiceWorker(GURL(scope_string), callback); | 
| 670 } | 674 } | 
| 671 | 675 | 
| 672 }  // namespace content | 676 }  // namespace content | 
| OLD | NEW | 
|---|