1 // Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights 2 // reserved. Use of this source code is governed by a BSD-style license that 3 // can be found in the LICENSE file. 4 5 #ifndef CEF_LIBCEF_COMMON_RESPONSE_IMPL_H_ 6 #define CEF_LIBCEF_COMMON_RESPONSE_IMPL_H_ 7 #pragma once 8 9 #include "include/cef_response.h" 10 11 #include "base/synchronization/lock.h" 12 13 namespace net { 14 class HttpResponseHeaders; 15 } // namespace net 16 17 namespace blink { 18 class WebURLResponse; 19 } 20 21 // Implementation of CefResponse. 22 class CefResponseImpl : public CefResponse { 23 public: 24 CefResponseImpl(); 25 26 // CefResponse methods. 27 bool IsReadOnly() override; 28 cef_errorcode_t GetError() override; 29 void SetError(cef_errorcode_t error) override; 30 int GetStatus() override; 31 void SetStatus(int status) override; 32 CefString GetStatusText() override; 33 void SetStatusText(const CefString& statusText) override; 34 CefString GetMimeType() override; 35 void SetMimeType(const CefString& mimeType) override; 36 CefString GetCharset() override; 37 void SetCharset(const CefString& charset) override; 38 CefString GetHeaderByName(const CefString& name) override; 39 void SetHeaderByName(const CefString& name, 40 const CefString& value, 41 bool overwrite) override; 42 void GetHeaderMap(HeaderMap& headerMap) override; 43 void SetHeaderMap(const HeaderMap& headerMap) override; 44 CefString GetURL() override; 45 void SetURL(const CefString& url) override; 46 47 scoped_refptr<net::HttpResponseHeaders> GetResponseHeaders(); 48 void SetResponseHeaders(const net::HttpResponseHeaders& headers); 49 50 void Set(const blink::WebURLResponse& response); 51 52 void SetReadOnly(bool read_only); 53 54 protected: 55 cef_errorcode_t error_code_; 56 int status_code_; 57 CefString status_text_; 58 CefString mime_type_; 59 CefString charset_; 60 CefString url_; 61 HeaderMap header_map_; 62 bool read_only_; 63 64 base::Lock lock_; 65 66 IMPLEMENT_REFCOUNTING(CefResponseImpl); 67 }; 68 69 #endif // CEF_LIBCEF_COMMON_RESPONSE_IMPL_H_ 70