Skip to content

Commit b3d38bc

Browse files
committed
add back cef_mac.h and cef_linux.h
1 parent ffbfdad commit b3d38bc

2 files changed

Lines changed: 234 additions & 0 deletions

File tree

src/include/internal/cef_linux.h

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are
5+
// met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above
10+
// copyright notice, this list of conditions and the following disclaimer
11+
// in the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Google Inc. nor the name Chromium Embedded
14+
// Framework nor the names of its contributors may be used to endorse
15+
// or promote products derived from this software without specific prior
16+
// written permission.
17+
//
18+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
30+
#ifndef CEF_INCLUDE_INTERNAL_CEF_LINUX_H_
31+
#define CEF_INCLUDE_INTERNAL_CEF_LINUX_H_
32+
#pragma once
33+
34+
#include "include/internal/cef_types_linux.h"
35+
#include "include/internal/cef_types_wrappers.h"
36+
37+
// Handle types.
38+
#define CefCursorHandle cef_cursor_handle_t
39+
#define CefEventHandle cef_event_handle_t
40+
#define CefWindowHandle cef_window_handle_t
41+
42+
///
43+
/// Class representing CefExecuteProcess arguments.
44+
///
45+
class CefMainArgs : public cef_main_args_t {
46+
public:
47+
CefMainArgs() : cef_main_args_t{} {}
48+
CefMainArgs(const cef_main_args_t& r) : cef_main_args_t(r) {}
49+
CefMainArgs(int argc_arg, char** argv_arg)
50+
: cef_main_args_t{argc_arg, argv_arg} {}
51+
};
52+
53+
struct CefWindowInfoTraits {
54+
typedef cef_window_info_t struct_type;
55+
56+
static inline void init(struct_type* s) {}
57+
58+
static inline void clear(struct_type* s) {
59+
cef_string_clear(&s->window_name);
60+
}
61+
62+
static inline void set(const struct_type* src,
63+
struct_type* target,
64+
bool copy) {
65+
cef_string_set(src->window_name.str, src->window_name.length,
66+
&target->window_name, copy);
67+
target->bounds = src->bounds;
68+
target->parent_window = src->parent_window;
69+
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
70+
target->shared_texture_enabled = src->shared_texture_enabled;
71+
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
72+
target->window = src->window;
73+
}
74+
};
75+
76+
///
77+
/// Class representing window information.
78+
///
79+
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
80+
public:
81+
typedef CefStructBase<CefWindowInfoTraits> parent;
82+
83+
CefWindowInfo() : parent() {}
84+
explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
85+
explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
86+
87+
CefWindowInfo& operator=(const CefWindowInfo&) = default;
88+
CefWindowInfo& operator=(CefWindowInfo&&) = default;
89+
90+
///
91+
/// Create the browser as a child window.
92+
///
93+
void SetAsChild(CefWindowHandle parent, const CefRect& bounds) {
94+
parent_window = parent;
95+
this->bounds = bounds;
96+
}
97+
98+
///
99+
/// Create the browser using windowless (off-screen) rendering. No window
100+
/// will be created for the browser and all rendering will occur via the
101+
/// CefRenderHandler interface. The |parent| value will be used to identify
102+
/// monitor info and to act as the parent window for dialogs, context menus,
103+
/// etc. If |parent| is not provided then the main screen monitor will be used
104+
/// and some functionality that requires a parent window may not function
105+
/// correctly. In order to create windowless browsers the
106+
/// CefSettings.windowless_rendering_enabled value must be set to true.
107+
/// Transparent painting is enabled by default but can be disabled by setting
108+
/// CefBrowserSettings.background_color to an opaque value.
109+
///
110+
void SetAsWindowless(CefWindowHandle parent) {
111+
windowless_rendering_enabled = true;
112+
parent_window = parent;
113+
}
114+
};
115+
116+
#endif // CEF_INCLUDE_INTERNAL_CEF_LINUX_H_

src/include/internal/cef_mac.h

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are
5+
// met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above
10+
// copyright notice, this list of conditions and the following disclaimer
11+
// in the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Google Inc. nor the name Chromium Embedded
14+
// Framework nor the names of its contributors may be used to endorse
15+
// or promote products derived from this software without specific prior
16+
// written permission.
17+
//
18+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
30+
#ifndef CEF_INCLUDE_INTERNAL_CEF_MAC_H_
31+
#define CEF_INCLUDE_INTERNAL_CEF_MAC_H_
32+
#pragma once
33+
34+
#include "include/internal/cef_types_mac.h"
35+
#include "include/internal/cef_types_wrappers.h"
36+
37+
// Handle types.
38+
#define CefCursorHandle cef_cursor_handle_t
39+
#define CefEventHandle cef_event_handle_t
40+
#define CefWindowHandle cef_window_handle_t
41+
42+
///
43+
/// Class representing CefExecuteProcess arguments.
44+
///
45+
class CefMainArgs : public cef_main_args_t {
46+
public:
47+
CefMainArgs() : cef_main_args_t{} {}
48+
CefMainArgs(const cef_main_args_t& r) : cef_main_args_t(r) {}
49+
CefMainArgs(int argc_arg, char** argv_arg)
50+
: cef_main_args_t{argc_arg, argv_arg} {}
51+
};
52+
53+
struct CefWindowInfoTraits {
54+
typedef cef_window_info_t struct_type;
55+
56+
static inline void init(struct_type* s) {}
57+
58+
static inline void clear(struct_type* s) {
59+
cef_string_clear(&s->window_name);
60+
}
61+
62+
static inline void set(const struct_type* src,
63+
struct_type* target,
64+
bool copy) {
65+
cef_string_set(src->window_name.str, src->window_name.length,
66+
&target->window_name, copy);
67+
target->bounds = src->bounds;
68+
target->hidden = src->hidden;
69+
target->parent_view = src->parent_view;
70+
target->windowless_rendering_enabled = src->windowless_rendering_enabled;
71+
target->shared_texture_enabled = src->shared_texture_enabled;
72+
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
73+
target->view = src->view;
74+
}
75+
};
76+
77+
///
78+
/// Class representing window information.
79+
///
80+
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
81+
public:
82+
typedef CefStructBase<CefWindowInfoTraits> parent;
83+
84+
CefWindowInfo() : parent() {}
85+
explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
86+
explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
87+
88+
CefWindowInfo& operator=(const CefWindowInfo&) = default;
89+
CefWindowInfo& operator=(CefWindowInfo&&) = default;
90+
91+
///
92+
/// Create the browser as a child view.
93+
///
94+
void SetAsChild(CefWindowHandle parent, const CefRect& bounds) {
95+
parent_view = parent;
96+
this->bounds = bounds;
97+
hidden = false;
98+
}
99+
100+
///
101+
/// Create the browser using windowless (off-screen) rendering. No view
102+
/// will be created for the browser and all rendering will occur via the
103+
/// CefRenderHandler interface. The |parent| value will be used to identify
104+
/// monitor info and to act as the parent view for dialogs, context menus,
105+
/// etc. If |parent| is not provided then the main screen monitor will be used
106+
/// and some functionality that requires a parent view may not function
107+
/// correctly. In order to create windowless browsers the
108+
/// CefSettings.windowless_rendering_enabled value must be set to true.
109+
/// Transparent painting is enabled by default but can be disabled by setting
110+
/// CefBrowserSettings.background_color to an opaque value.
111+
///
112+
void SetAsWindowless(CefWindowHandle parent) {
113+
windowless_rendering_enabled = true;
114+
parent_view = parent;
115+
}
116+
};
117+
118+
#endif // CEF_INCLUDE_INTERNAL_CEF_MAC_H_

0 commit comments

Comments
 (0)