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

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

Issue 62203007: Implement memory-persistent registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working version Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/service_worker/service_worker_context_core.h" 8 #include "content/browser/service_worker/service_worker_context_core.h"
9 #include "content/browser/service_worker/service_worker_context_wrapper.h" 9 #include "content/browser/service_worker/service_worker_context_wrapper.h"
10 #include "content/common/service_worker_messages.h" 10 #include "content/common/service_worker_messages.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 OnUnregisterServiceWorker) 64 OnUnregisterServiceWorker)
65 IPC_MESSAGE_UNHANDLED(handled = false) 65 IPC_MESSAGE_UNHANDLED(handled = false)
66 IPC_END_MESSAGE_MAP() 66 IPC_END_MESSAGE_MAP()
67 67
68 return handled; 68 return handled;
69 } 69 }
70 70
71 void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( 71 void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(
72 int32 thread_id, 72 int32 thread_id,
73 int32 request_id, 73 int32 request_id,
74 const GURL& scope, 74 const GURL& pattern,
75 const GURL& script_url) { 75 const GURL& script_url) {
76 if (!context_ || !context_->IsEnabled()) { 76 if (!context_ || !context_->IsEnabled()) {
77 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 77 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
78 thread_id, 78 thread_id,
79 request_id, 79 request_id,
80 blink::WebServiceWorkerError::DisabledError, 80 blink::WebServiceWorkerError::DisabledError,
81 ASCIIToUTF16(kDisabledErrorMessage))); 81 ASCIIToUTF16(kDisabledErrorMessage)));
82 return; 82 return;
83 } 83 }
84 84
85 // TODO(alecflett): This check is insufficient for release. Add a 85 // TODO(alecflett): This check is insufficient for release. Add a
86 // ServiceWorker-specific policy query in 86 // ServiceWorker-specific policy query in
87 // ChildProcessSecurityImpl. See http://crbug.com/311631. 87 // ChildProcessSecurityImpl. See http://crbug.com/311631.
88 if (scope.GetOrigin() != script_url.GetOrigin()) { 88 if (pattern.GetOrigin() != script_url.GetOrigin()) {
89 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 89 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
90 thread_id, 90 thread_id,
91 request_id, 91 request_id,
92 blink::WebServiceWorkerError::SecurityError, 92 blink::WebServiceWorkerError::SecurityError,
93 ASCIIToUTF16(kDomainMismatchErrorMessage))); 93 ASCIIToUTF16(kDomainMismatchErrorMessage)));
94 return; 94 return;
95 } 95 }
96 96
97 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( 97 Send(new ServiceWorkerMsg_ServiceWorkerRegistered(
98 thread_id, request_id, NextWorkerId())); 98 thread_id, request_id, NextWorkerId()));
99 } 99 }
100 100
101 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(int32 thread_id, 101 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(
102 int32 request_id, 102 int32 thread_id,
103 const GURL& scope) { 103 int32 request_id,
104 const GURL& pattern) {
104 // TODO(alecflett): This check is insufficient for release. Add a 105 // TODO(alecflett): This check is insufficient for release. Add a
105 // ServiceWorker-specific policy query in 106 // ServiceWorker-specific policy query in
106 // ChildProcessSecurityImpl. See http://crbug.com/311631. 107 // ChildProcessSecurityImpl. See http://crbug.com/311631.
107 if (!context_ || !context_->IsEnabled()) { 108 if (!context_ || !context_->IsEnabled()) {
108 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 109 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
109 thread_id, 110 thread_id,
110 request_id, 111 request_id,
111 blink::WebServiceWorkerError::DisabledError, 112 blink::WebServiceWorkerError::DisabledError,
112 ASCIIToUTF16(kDisabledErrorMessage))); 113 ASCIIToUTF16(kDisabledErrorMessage)));
113 return; 114 return;
114 } 115 }
115 116
116 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id)); 117 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id));
117 } 118 }
118 119
119 } // namespace content 120 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698