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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/InstallEvent.cpp

Issue 2746783002: [ServiceWorker] Mojofy InstallEvent of Service Worker (Closed)
Patch Set: Just delete a useless line Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "modules/serviceworkers/InstallEvent.h" 5 #include "modules/serviceworkers/InstallEvent.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
11 #include "public/platform/WebSecurityOrigin.h" 11 #include "public/platform/WebSecurityOrigin.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 InstallEvent* InstallEvent::Create(const AtomicString& type, 15 InstallEvent* InstallEvent::Create(const AtomicString& type,
16 const ExtendableEventInit& event_init) { 16 const ExtendableEventInit& event_init) {
17 return new InstallEvent(type, event_init); 17 return new InstallEvent(type, event_init);
18 } 18 }
19 19
20 InstallEvent* InstallEvent::Create(const AtomicString& type, 20 InstallEvent* InstallEvent::Create(const AtomicString& type,
21 const ExtendableEventInit& event_init, 21 const ExtendableEventInit& event_init,
22 int event_id,
22 WaitUntilObserver* observer) { 23 WaitUntilObserver* observer) {
23 return new InstallEvent(type, event_init, observer); 24 return new InstallEvent(type, event_init, event_id, observer);
24 } 25 }
25 26
26 InstallEvent::~InstallEvent() {} 27 InstallEvent::~InstallEvent() {}
27 28
28 void InstallEvent::registerForeignFetch(ScriptState* script_state, 29 void InstallEvent::registerForeignFetch(ScriptState* script_state,
29 const ForeignFetchOptions& options, 30 const ForeignFetchOptions& options,
30 ExceptionState& exception_state) { 31 ExceptionState& exception_state) {
31 if (!IsBeingDispatched()) { 32 if (!IsBeingDispatched()) {
32 exception_state.ThrowDOMException(kInvalidStateError, 33 exception_state.ThrowDOMException(kInvalidStateError,
33 "The event handler is already finished."); 34 "The event handler is already finished.");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 sub_scopes[i]); 83 sub_scopes[i]);
83 return; 84 return;
84 } 85 }
85 String sub_scope_path = sub_scope_urls[i].GetPath(); 86 String sub_scope_path = sub_scope_urls[i].GetPath();
86 if (!sub_scope_path.StartsWith(scope_path)) { 87 if (!sub_scope_path.StartsWith(scope_path)) {
87 exception_state.ThrowTypeError("Subscope URL is not within scope: " + 88 exception_state.ThrowTypeError("Subscope URL is not within scope: " +
88 sub_scopes[i]); 89 sub_scopes[i]);
89 return; 90 return;
90 } 91 }
91 } 92 }
92 client->RegisterForeignFetchScopes(sub_scope_urls, parsed_origins); 93 client->RegisterForeignFetchScopes(event_id_, sub_scope_urls, parsed_origins);
93 } 94 }
94 95
95 const AtomicString& InstallEvent::InterfaceName() const { 96 const AtomicString& InstallEvent::InterfaceName() const {
96 return EventNames::InstallEvent; 97 return EventNames::InstallEvent;
97 } 98 }
98 99
99 InstallEvent::InstallEvent(const AtomicString& type, 100 InstallEvent::InstallEvent(const AtomicString& type,
100 const ExtendableEventInit& initializer) 101 const ExtendableEventInit& initializer)
101 : ExtendableEvent(type, initializer) {} 102 : ExtendableEvent(type, initializer), event_id_(0) {}
102 103
103 InstallEvent::InstallEvent(const AtomicString& type, 104 InstallEvent::InstallEvent(const AtomicString& type,
104 const ExtendableEventInit& initializer, 105 const ExtendableEventInit& initializer,
106 int event_id,
105 WaitUntilObserver* observer) 107 WaitUntilObserver* observer)
106 : ExtendableEvent(type, initializer, observer) {} 108 : ExtendableEvent(type, initializer, observer), event_id_(event_id) {}
107 109
108 } // namespace blink 110 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698