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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 301103003: Rename navigator.serviceWorker.current to controller. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bring rebaselines to head. Created 6 years, 6 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 resolver->reject(DOMException::create(SecurityError, "Can only unregiste r for patterns in the document's origin.")); 135 resolver->reject(DOMException::create(SecurityError, "Can only unregiste r for patterns in the document's origin."));
136 return promise; 136 return promise;
137 } 137 }
138 138
139 m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<U ndefinedValue, ServiceWorkerError>(resolver)); 139 m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<U ndefinedValue, ServiceWorkerError>(resolver));
140 return promise; 140 return promise;
141 } 141 }
142 142
143 void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* se rviceWorker) 143 void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* se rviceWorker)
144 { 144 {
145 setController(serviceWorker);
146 }
147
148 void ServiceWorkerContainer::setController(blink::WebServiceWorker* serviceWorke r)
149 {
145 if (!executionContext()) { 150 if (!executionContext()) {
146 delete serviceWorker; 151 delete serviceWorker;
147 return; 152 return;
148 } 153 }
149 m_current = ServiceWorker::create(executionContext(), adoptPtr(serviceWorker )); 154 m_controller = ServiceWorker::create(executionContext(), adoptPtr(serviceWor ker));
150 } 155 }
151 156
152 void ServiceWorkerContainer::dispatchMessageEvent(const blink::WebString& messag e, const blink::WebMessagePortChannelArray& webChannels) 157 void ServiceWorkerContainer::dispatchMessageEvent(const blink::WebString& messag e, const blink::WebMessagePortChannelArray& webChannels)
153 { 158 {
154 if (!executionContext() || !window()) 159 if (!executionContext() || !window())
155 return; 160 return;
156 161
157 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(executionCo ntext(), webChannels); 162 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(executionCo ntext(), webChannels);
158 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire( message); 163 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire( message);
159 window()->dispatchEvent(MessageEvent::create(ports.release(), value)); 164 window()->dispatchEvent(MessageEvent::create(ports.release(), value));
(...skipping 10 matching lines...) Expand all
170 return; 175 return;
171 176
172 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { 177 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) {
173 m_provider = client->provider(); 178 m_provider = client->provider();
174 if (m_provider) 179 if (m_provider)
175 m_provider->setClient(this); 180 m_provider->setClient(this);
176 } 181 }
177 } 182 }
178 183
179 } // namespace WebCore 184 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.h ('k') | Source/modules/serviceworkers/ServiceWorkerContainer.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698