Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "Response.h" | |
| 7 | |
| 8 #include "bindings/v8/Dictionary.h" | |
| 9 #include "platform/NotImplemented.h" | |
| 10 | |
| 11 namespace WebCore { | |
| 12 | |
| 13 PassRefPtr<Response> Response::create() | |
| 14 { | |
| 15 return adoptRef(new Response()); | |
| 16 } | |
| 17 | |
| 18 PassRefPtr<Response> Response::create(const Dictionary& responseInit) | |
| 19 { | |
| 20 RefPtr<Response> response = adoptRef(new Response()); | |
| 21 unsigned short statusCode; | |
| 22 if (responseInit.get("statusCode", statusCode)) | |
| 23 response->setStatusCode(statusCode); | |
| 24 String string; | |
| 25 if (responseInit.get("statusText", string)) | |
| 26 response->setStatusText(string); | |
| 27 if (responseInit.get("method", string)) | |
| 28 response->setMethod(string); | |
| 29 Dictionary dictionary; | |
| 30 if (responseInit.get("headers", dictionary)) | |
| 31 response->headers(dictionary); | |
| 32 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.
| |
| 33 } | |
| 34 | |
| 35 void Response::headers(const Dictionary& headers) | |
| 36 { | |
| 37 notImplemented(); | |
| 38 } | |
| 39 | |
| 40 Dictionary* Response::headers() | |
| 41 { | |
| 42 // FIXME: Implement. Spec will eventually whitelist allowable headers. | |
| 43 return &m_headers; | |
| 44 } | |
| 45 | |
| 46 Response::Response() | |
| 47 { | |
| 48 ScriptWrappable::init(this); | |
| 49 } | |
| 50 | |
| 51 } // namespace WebCore | |
| OLD | NEW |