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

Side by Side Diff: Source/modules/serviceworkers/FetchEvent.h

Issue 304053003: ServiceWorker: support Request.{url,method,origin,headers} [blink] (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for Request. 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
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 #ifndef FetchEvent_h 5 #ifndef FetchEvent_h
6 #define FetchEvent_h 6 #define FetchEvent_h
7 7
8 #include "modules/EventModules.h" 8 #include "modules/EventModules.h"
9 #include "modules/serviceworkers/Request.h"
9 #include "modules/serviceworkers/RespondWithObserver.h" 10 #include "modules/serviceworkers/RespondWithObserver.h"
10 11
11 namespace WebCore { 12 namespace WebCore {
12 13
13 class ExecutionContext; 14 class ExecutionContext;
15 class Request;
14 class RespondWithObserver; 16 class RespondWithObserver;
15 17
16 // A fetch event is dispatched by the client to a service worker's script 18 // A fetch event is dispatched by the client to a service worker's script
17 // context. RespondWithObserver can be used to notify the client about the 19 // context. RespondWithObserver can be used to notify the client about the
18 // service worker's response. 20 // service worker's response.
19 class FetchEvent FINAL : public Event { 21 class FetchEvent FINAL : public Event {
20 public: 22 public:
21 static PassRefPtrWillBeRawPtr<FetchEvent> create(); 23 static PassRefPtrWillBeRawPtr<FetchEvent> create();
24 // TODO(horo): Remove this.
22 static PassRefPtrWillBeRawPtr<FetchEvent> create(PassRefPtr<RespondWithObser ver>); 25 static PassRefPtrWillBeRawPtr<FetchEvent> create(PassRefPtr<RespondWithObser ver>);
26 static PassRefPtrWillBeRawPtr<FetchEvent> create(PassRefPtr<RespondWithObser ver>, PassRefPtr<Request>);
23 virtual ~FetchEvent() { } 27 virtual ~FetchEvent() { }
24 28
29 Request* request() const;
30
25 void respondWith(const ScriptValue&); 31 void respondWith(const ScriptValue&);
26 32
27 virtual const AtomicString& interfaceName() const OVERRIDE; 33 virtual const AtomicString& interfaceName() const OVERRIDE;
28 34
29 virtual void trace(Visitor*) OVERRIDE; 35 virtual void trace(Visitor*) OVERRIDE;
30 36
31 protected: 37 protected:
32 FetchEvent(); 38 FetchEvent();
39 // TODO(horo): Remove this.
33 explicit FetchEvent(PassRefPtr<RespondWithObserver>); 40 explicit FetchEvent(PassRefPtr<RespondWithObserver>);
41 FetchEvent(PassRefPtr<RespondWithObserver>, PassRefPtr<Request>);
34 42
35 private: 43 private:
36 RefPtr<RespondWithObserver> m_observer; 44 RefPtr<RespondWithObserver> m_observer;
45 RefPtr<Request> m_request;
37 }; 46 };
38 47
39 } // namespace WebCore 48 } // namespace WebCore
40 49
41 #endif // FetchEvent_h 50 #endif // FetchEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698