• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 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 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=ed13956e5941bbb0885224ef57016cf7f34d389c$
13 //
14 
15 #ifndef CEF_LIBCEF_DLL_CTOCPP_SERVER_CTOCPP_H_
16 #define CEF_LIBCEF_DLL_CTOCPP_SERVER_CTOCPP_H_
17 #pragma once
18 
19 #if !defined(WRAPPING_CEF_SHARED)
20 #error This file can be included wrapper-side only
21 #endif
22 
23 #include "include/capi/cef_server_capi.h"
24 #include "include/cef_server.h"
25 #include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
26 
27 // Wrap a C structure with a C++ class.
28 // This class may be instantiated and accessed wrapper-side only.
29 class CefServerCToCpp
30     : public CefCToCppRefCounted<CefServerCToCpp, CefServer, cef_server_t> {
31  public:
32   CefServerCToCpp();
33   virtual ~CefServerCToCpp();
34 
35   // CefServer methods.
36   CefRefPtr<CefTaskRunner> GetTaskRunner() override;
37   void Shutdown() override;
38   bool IsRunning() override;
39   CefString GetAddress() override;
40   bool HasConnection() override;
41   bool IsValidConnection(int connection_id) override;
42   void SendHttp200Response(int connection_id,
43                            const CefString& content_type,
44                            const void* data,
45                            size_t data_size) override;
46   void SendHttp404Response(int connection_id) override;
47   void SendHttp500Response(int connection_id,
48                            const CefString& error_message) override;
49   void SendHttpResponse(int connection_id,
50                         int response_code,
51                         const CefString& content_type,
52                         int64 content_length,
53                         const HeaderMap& extra_headers) override;
54   void SendRawData(int connection_id,
55                    const void* data,
56                    size_t data_size) override;
57   void CloseConnection(int connection_id) override;
58   void SendWebSocketMessage(int connection_id,
59                             const void* data,
60                             size_t data_size) override;
61 };
62 
63 #endif  // CEF_LIBCEF_DLL_CTOCPP_SERVER_CTOCPP_H_
64