summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h')
-rw-r--r--chromium/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/chromium/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h b/chromium/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h
new file mode 100644
index 00000000000..50b7a729f8d
--- /dev/null
+++ b/chromium/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.h
@@ -0,0 +1,46 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef FetchEvent_h
+#define FetchEvent_h
+
+#include "modules/EventModules.h"
+#include "modules/serviceworkers/Request.h"
+#include "modules/serviceworkers/RespondWithObserver.h"
+
+namespace WebCore {
+
+class ExecutionContext;
+class Request;
+class RespondWithObserver;
+
+// A fetch event is dispatched by the client to a service worker's script
+// context. RespondWithObserver can be used to notify the client about the
+// service worker's response.
+class FetchEvent FINAL : public Event {
+public:
+ static PassRefPtrWillBeRawPtr<FetchEvent> create();
+ static PassRefPtrWillBeRawPtr<FetchEvent> create(PassRefPtr<RespondWithObserver>, PassRefPtr<Request>);
+ virtual ~FetchEvent() { }
+
+ Request* request() const;
+
+ void respondWith(ScriptState*, const ScriptValue&);
+
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ virtual void trace(Visitor*) OVERRIDE;
+
+protected:
+ FetchEvent();
+ FetchEvent(PassRefPtr<RespondWithObserver>, PassRefPtr<Request>);
+
+private:
+ RefPtr<RespondWithObserver> m_observer;
+ RefPtr<Request> m_request;
+};
+
+} // namespace WebCore
+
+#endif // FetchEvent_h