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

Unified Diff: Source/modules/serviceworkers/Response.cpp

Issue 180843003: Start to implement FetchEvent for ServiceWorker (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/serviceworkers/Response.cpp
diff --git a/Source/modules/serviceworkers/Response.cpp b/Source/modules/serviceworkers/Response.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2ce141615f381c2431a60d3c06252d08d0ff1887
--- /dev/null
+++ b/Source/modules/serviceworkers/Response.cpp
@@ -0,0 +1,51 @@
+// 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.
+
+#include "config.h"
+#include "Response.h"
+
+#include "bindings/v8/Dictionary.h"
+#include "platform/NotImplemented.h"
+
+namespace WebCore {
+
+PassRefPtr<Response> Response::create()
+{
+ return adoptRef(new Response());
+}
+
+PassRefPtr<Response> Response::create(const Dictionary& responseInit)
+{
+ RefPtr<Response> response = adoptRef(new Response());
+ unsigned short statusCode;
+ if (responseInit.get("statusCode", statusCode))
+ response->setStatusCode(statusCode);
+ String string;
+ if (responseInit.get("statusText", string))
+ response->setStatusText(string);
+ if (responseInit.get("method", string))
+ response->setMethod(string);
+ Dictionary dictionary;
+ if (responseInit.get("headers", dictionary))
+ response->headers(dictionary);
+ return response;
kinuko 2014/02/26 05:42:49 I prefer defining ResponseInit in a separate heade
falken 2014/02/27 06:45:09 Done. Good idea, that's much better.
+}
+
+void Response::headers(const Dictionary& headers)
+{
+ notImplemented();
+}
+
+Dictionary* Response::headers()
+{
+ // FIXME: Implement. Spec will eventually whitelist allowable headers.
+ return &m_headers;
+}
+
+Response::Response()
+{
+ ScriptWrappable::init(this);
+}
+
+} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698