Chromium Code Reviews| 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 |