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

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

Issue 208843004: Add the beginning of a public Service Worker API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix #include guard name Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // ForEachStoragePartition is synchronous. 117 // ForEachStoragePartition is synchronous.
118 BrowserContext::StoragePartitionCallback cb = 118 BrowserContext::StoragePartitionCallback cb =
119 base::Bind(&ServiceWorkerInternalsUI::AddContextFromStoragePartition, 119 base::Bind(&ServiceWorkerInternalsUI::AddContextFromStoragePartition,
120 base::Unretained(this)); 120 base::Unretained(this));
121 BrowserContext::ForEachStoragePartition(browser_context, cb); 121 BrowserContext::ForEachStoragePartition(browser_context, cb);
122 } 122 }
123 123
124 void ServiceWorkerInternalsUI::AddContextFromStoragePartition( 124 void ServiceWorkerInternalsUI::AddContextFromStoragePartition(
125 StoragePartition* partition) { 125 StoragePartition* partition) {
126 scoped_refptr<ServiceWorkerContextWrapper> context = 126 scoped_refptr<ServiceWorkerContextWrapper> context =
127 partition->GetServiceWorkerContext(); 127 static_cast<ServiceWorkerContextWrapper*>(
128 partition->GetServiceWorkerContext());
128 BrowserThread::PostTask( 129 BrowserThread::PostTask(
129 BrowserThread::IO, 130 BrowserThread::IO,
130 FROM_HERE, 131 FROM_HERE,
131 base::Bind( 132 base::Bind(
132 &ServiceWorkerInternalsUI::OperationProxy::GetRegistrationsOnIOThread, 133 &ServiceWorkerInternalsUI::OperationProxy::GetRegistrationsOnIOThread,
133 new OperationProxy(AsWeakPtr(), scoped_ptr<ListValue>()), 134 new OperationProxy(AsWeakPtr(), scoped_ptr<ListValue>()),
134 context, 135 context,
135 partition->GetPath())); 136 partition->GetPath()));
136 } 137 }
137 138
138 namespace { 139 namespace {
139 void FindContext(const base::FilePath& partition_path, 140 void FindContext(const base::FilePath& partition_path,
140 StoragePartition** result_partition, 141 StoragePartition** result_partition,
141 scoped_refptr<ServiceWorkerContextWrapper>* result_context, 142 scoped_refptr<ServiceWorkerContextWrapper>* result_context,
142 StoragePartition* storage_partition) { 143 StoragePartition* storage_partition) {
143 if (storage_partition->GetPath() == partition_path) { 144 if (storage_partition->GetPath() == partition_path) {
144 *result_partition = storage_partition; 145 *result_partition = storage_partition;
145 *result_context = storage_partition->GetServiceWorkerContext(); 146 *result_context = static_cast<ServiceWorkerContextWrapper*>(
147 storage_partition->GetServiceWorkerContext());
146 } 148 }
147 } 149 }
148 } // namespace 150 } // namespace
149 151
150 bool ServiceWorkerInternalsUI::GetRegistrationInfo( 152 bool ServiceWorkerInternalsUI::GetRegistrationInfo(
151 const ListValue* args, 153 const ListValue* args,
152 base::FilePath* partition_path, 154 base::FilePath* partition_path,
153 GURL* scope, 155 GURL* scope,
154 scoped_refptr<ServiceWorkerContextWrapper>* context) const { 156 scoped_refptr<ServiceWorkerContextWrapper>* context) const {
155 base::FilePath::StringType path_string; 157 base::FilePath::StringType path_string;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (status == SERVICE_WORKER_OK) { 414 if (status == SERVICE_WORKER_OK) {
413 registration->active_version()->StopWorker(base::Bind( 415 registration->active_version()->StopWorker(base::Bind(
414 &ServiceWorkerInternalsUI::OperationProxy::OperationComplete, this)); 416 &ServiceWorkerInternalsUI::OperationProxy::OperationComplete, this));
415 return; 417 return;
416 } 418 }
417 419
418 OperationComplete(status); 420 OperationComplete(status);
419 } 421 }
420 422
421 } // namespace content 423 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698