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

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

Issue 990583002: Use UUID for ServiceWorker Client identifier (1/3, blink) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
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 "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" 6 #include "modules/serviceworkers/ServiceWorkerWindowClient.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 { 70 {
71 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 71 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
72 ScriptPromise promise = resolver->promise(); 72 ScriptPromise promise = resolver->promise();
73 73
74 if (!scriptState->executionContext()->isWindowInteractionAllowed()) { 74 if (!scriptState->executionContext()->isWindowInteractionAllowed()) {
75 resolver->reject(DOMException::create(InvalidAccessError, "Not allowed t o focus a window.")); 75 resolver->reject(DOMException::create(InvalidAccessError, "Not allowed t o focus a window."));
76 return promise; 76 return promise;
77 } 77 }
78 scriptState->executionContext()->consumeWindowInteraction(); 78 scriptState->executionContext()->consumeWindowInteraction();
79 79
80 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->focus (id(), new CallbackPromiseAdapter<ServiceWorkerWindowClient, ServiceWorkerError> (resolver)); 80 if (!uuid().isEmpty()) {
81 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->f ocus(uuid(), new CallbackPromiseAdapter<ServiceWorkerWindowClient, ServiceWorker Error>(resolver));
82 } else {
83 // FIXME: Deprecate this when we switch to uuid.
84 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->f ocus(id(), new CallbackPromiseAdapter<ServiceWorkerWindowClient, ServiceWorkerEr ror>(resolver));
85 }
81 return promise; 86 return promise;
82 } 87 }
83 88
84 DEFINE_TRACE(ServiceWorkerWindowClient) 89 DEFINE_TRACE(ServiceWorkerWindowClient)
85 { 90 {
86 ServiceWorkerClient::trace(visitor); 91 ServiceWorkerClient::trace(visitor);
87 } 92 }
88 93
89 } // namespace blink 94 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h ('k') | Source/web/ServiceWorkerGlobalScopeClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698