Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / browser / service_worker / service_worker_context_wrapper.cc
index d3f776d..3e98e49 100644 (file)
@@ -16,8 +16,8 @@
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
 #include "net/url_request/url_request_context_getter.h"
-#include "webkit/browser/blob/blob_storage_context.h"
-#include "webkit/browser/quota/quota_manager_proxy.h"
+#include "storage/browser/blob/blob_storage_context.h"
+#include "storage/browser/quota/quota_manager_proxy.h"
 
 namespace content {
 
@@ -34,14 +34,14 @@ ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() {
 
 void ServiceWorkerContextWrapper::Init(
     const base::FilePath& user_data_directory,
-    quota::QuotaManagerProxy* quota_manager_proxy) {
+    storage::QuotaManagerProxy* quota_manager_proxy) {
   is_incognito_ = user_data_directory.empty();
   scoped_refptr<base::SequencedTaskRunner> database_task_runner =
       BrowserThread::GetBlockingPool()->
           GetSequencedTaskRunnerWithShutdownBehavior(
               BrowserThread::GetBlockingPool()->GetSequenceToken(),
               base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
-  scoped_refptr<base::MessageLoopProxy> disk_cache_thread =
+  scoped_refptr<base::SingleThreadTaskRunner> disk_cache_thread =
       BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE);
   scoped_refptr<base::SequencedTaskRunner> cache_task_runner =
       BrowserThread::GetBlockingPool()
@@ -106,7 +106,6 @@ void ServiceWorkerContextWrapper::RegisterServiceWorker(
   context()->RegisterServiceWorker(
       pattern,
       script_url,
-      -1,
       NULL /* provider_host */,
       base::Bind(&FinishRegistrationOnIO, continuation));
 }
@@ -166,7 +165,7 @@ void ServiceWorkerContextWrapper::DidGetAllRegistrationsForGetAllOrigins(
        it != registrations.end();
        ++it) {
     const ServiceWorkerRegistrationInfo& registration_info = *it;
-    GURL origin = registration_info.script_url.GetOrigin();
+    GURL origin = registration_info.pattern.GetOrigin();
 
     ServiceWorkerUsageInfo& usage_info = origins[origin];
     if (usage_info.origin.is_empty())
@@ -209,7 +208,7 @@ void ServiceWorkerContextWrapper::DidGetAllRegistrationsForDeleteForOrigin(
        it != registrations.end();
        ++it) {
     const ServiceWorkerRegistrationInfo& registration_info = *it;
-    if (origin == registration_info.script_url.GetOrigin()) {
+    if (origin == registration_info.pattern.GetOrigin()) {
       UnregisterServiceWorker(registration_info.pattern,
                               base::Bind(&EmptySuccessCallback));
     }
@@ -240,10 +239,10 @@ void ServiceWorkerContextWrapper::SetBlobParametersForCache(
 
 void ServiceWorkerContextWrapper::InitInternal(
     const base::FilePath& user_data_directory,
-    base::SequencedTaskRunner* stores_task_runner,
-    base::SequencedTaskRunner* database_task_runner,
-    base::MessageLoopProxy* disk_cache_thread,
-    quota::QuotaManagerProxy* quota_manager_proxy) {
+    const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner,
+    const scoped_refptr<base::SequencedTaskRunner>& database_task_runner,
+    const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread,
+    storage::QuotaManagerProxy* quota_manager_proxy) {
   if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
     BrowserThread::PostTask(
         BrowserThread::IO,
@@ -251,9 +250,9 @@ void ServiceWorkerContextWrapper::InitInternal(
         base::Bind(&ServiceWorkerContextWrapper::InitInternal,
                    this,
                    user_data_directory,
-                   make_scoped_refptr(stores_task_runner),
-                   make_scoped_refptr(database_task_runner),
-                   make_scoped_refptr(disk_cache_thread),
+                   stores_task_runner,
+                   database_task_runner,
+                   disk_cache_thread,
                    make_scoped_refptr(quota_manager_proxy)));
     return;
   }
@@ -263,7 +262,7 @@ void ServiceWorkerContextWrapper::InitInternal(
                                                    database_task_runner,
                                                    disk_cache_thread,
                                                    quota_manager_proxy,
-                                                   observer_list_,
+                                                   observer_list_.get(),
                                                    this));
 }