Skip to content

Commit 30c46e0

Browse files
committed
Updated cef1/include to match branch 1364
revision 1248. Created Cython compile script (python). Makefile for v8function_handler not yet complete.
1 parent 53d484f commit 30c46e0

22 files changed

Lines changed: 739 additions & 3410 deletions
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
// Copyright (c) 2011 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_CEF_APPLICATION_MAC_H_
31+
#define CEF_INCLUDE_CEF_APPLICATION_MAC_H_
32+
#pragma once
33+
34+
#include "include/cef_base.h"
35+
36+
#if defined(OS_MACOSX) && defined(__OBJC__)
37+
38+
#ifdef BUILDING_CEF_SHARED
39+
40+
// Use the existing CrAppProtocol definition.
41+
#include "base/message_pump_mac.h"
42+
43+
// Use the existing empty protocol definitions.
44+
#import "base/mac/cocoa_protocols.h"
45+
46+
#else // BUILDING_CEF_SHARED
47+
48+
#import <AppKit/AppKit.h>
49+
#import <Cocoa/Cocoa.h>
50+
51+
// Copy of CrAppProtocol definition from base/message_pump_mac.h.
52+
@protocol CrAppProtocol
53+
// Must return true if -[NSApplication sendEvent:] is currently on the stack.
54+
- (BOOL)isHandlingSendEvent;
55+
@end
56+
57+
// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These
58+
// protocol defintions were not present in earlier releases of the Mac OS X
59+
// SDK. In order to support building against the new SDK, which requires
60+
// delegates to conform to these protocols, and earlier SDKs, which do not
61+
// define these protocols at all, this file will provide empty protocol
62+
// definitions when used with earlier SDK versions.
63+
64+
#if !defined(MAC_OS_X_VERSION_10_6) || \
65+
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
66+
67+
#define DEFINE_EMPTY_PROTOCOL(p) \
68+
@protocol p \
69+
@end
70+
71+
DEFINE_EMPTY_PROTOCOL(NSAlertDelegate)
72+
DEFINE_EMPTY_PROTOCOL(NSApplicationDelegate)
73+
DEFINE_EMPTY_PROTOCOL(NSControlTextEditingDelegate)
74+
DEFINE_EMPTY_PROTOCOL(NSMatrixDelegate)
75+
DEFINE_EMPTY_PROTOCOL(NSMenuDelegate)
76+
DEFINE_EMPTY_PROTOCOL(NSOpenSavePanelDelegate)
77+
DEFINE_EMPTY_PROTOCOL(NSOutlineViewDataSource)
78+
DEFINE_EMPTY_PROTOCOL(NSOutlineViewDelegate)
79+
DEFINE_EMPTY_PROTOCOL(NSSpeechSynthesizerDelegate)
80+
DEFINE_EMPTY_PROTOCOL(NSSplitViewDelegate)
81+
DEFINE_EMPTY_PROTOCOL(NSTableViewDataSource)
82+
DEFINE_EMPTY_PROTOCOL(NSTableViewDelegate)
83+
DEFINE_EMPTY_PROTOCOL(NSTextFieldDelegate)
84+
DEFINE_EMPTY_PROTOCOL(NSTextViewDelegate)
85+
DEFINE_EMPTY_PROTOCOL(NSWindowDelegate)
86+
87+
#undef DEFINE_EMPTY_PROTOCOL
88+
89+
#endif
90+
91+
#endif // BUILDING_CEF_SHARED
92+
93+
// All CEF client applications must subclass NSApplication and implement this
94+
// protocol.
95+
@protocol CefAppProtocol<CrAppProtocol>
96+
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
97+
@end
98+
99+
// Controls the state of |isHandlingSendEvent| in the event loop so that it is
100+
// reset properly.
101+
class CefScopedSendingEvent {
102+
public:
103+
CefScopedSendingEvent()
104+
: app_(static_cast<NSApplication<CefAppProtocol>*>(
105+
[NSApplication sharedApplication])),
106+
handling_([app_ isHandlingSendEvent]) {
107+
[app_ setHandlingSendEvent:YES];
108+
}
109+
~CefScopedSendingEvent() {
110+
[app_ setHandlingSendEvent:handling_];
111+
}
112+
113+
private:
114+
NSApplication<CefAppProtocol>* app_;
115+
BOOL handling_;
116+
};
117+
118+
#endif // defined(OS_MACOSX) && defined(__OBJC__)
119+
120+
#endif // CEF_INCLUDE_CEF_APPLICATION_MAC_H_
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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+
31+
#ifndef CEF_INCLUDE_INTERNAL_CEF_LINUX_H_
32+
#define CEF_INCLUDE_INTERNAL_CEF_LINUX_H_
33+
#pragma once
34+
35+
#if defined(OS_LINUX)
36+
#include <pthread.h>
37+
#include "include/internal/cef_types_linux.h"
38+
#include "include/internal/cef_types_wrappers.h"
39+
40+
///
41+
// Atomic increment and decrement.
42+
///
43+
inline long CefAtomicIncrement(long volatile *pDest) { // NOLINT(runtime/int)
44+
return __sync_add_and_fetch(pDest, 1);
45+
}
46+
inline long CefAtomicDecrement(long volatile *pDest) { // NOLINT(runtime/int)
47+
return __sync_sub_and_fetch(pDest, 1);
48+
}
49+
50+
///
51+
// Critical section wrapper.
52+
///
53+
class CefCriticalSection {
54+
public:
55+
CefCriticalSection() {
56+
pthread_mutexattr_init(&attr_);
57+
pthread_mutexattr_settype(&attr_, PTHREAD_MUTEX_RECURSIVE);
58+
pthread_mutex_init(&lock_, &attr_);
59+
}
60+
virtual ~CefCriticalSection() {
61+
pthread_mutex_destroy(&lock_);
62+
pthread_mutexattr_destroy(&attr_);
63+
}
64+
void Lock() {
65+
pthread_mutex_lock(&lock_);
66+
}
67+
void Unlock() {
68+
pthread_mutex_unlock(&lock_);
69+
}
70+
71+
pthread_mutex_t lock_;
72+
pthread_mutexattr_t attr_;
73+
};
74+
75+
///
76+
// Handle types.
77+
///
78+
#define CefWindowHandle cef_window_handle_t
79+
#define CefCursorHandle cef_cursor_handle_t
80+
81+
82+
struct CefWindowInfoTraits {
83+
typedef cef_window_info_t struct_type;
84+
85+
static inline void init(struct_type* s) {}
86+
static inline void clear(struct_type* s) {}
87+
88+
static inline void set(const struct_type* src, struct_type* target,
89+
bool copy) {
90+
target->m_Widget = src->m_Widget;
91+
target->m_ParentWidget = src->m_ParentWidget;
92+
}
93+
};
94+
95+
///
96+
// Class representing window information.
97+
///
98+
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
99+
public:
100+
typedef CefStructBase<CefWindowInfoTraits> parent;
101+
102+
CefWindowInfo() : parent() {}
103+
explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
104+
explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
105+
106+
void SetAsChild(CefWindowHandle ParentWidget) {
107+
m_ParentWidget = ParentWidget;
108+
}
109+
};
110+
111+
112+
struct CefPrintInfoTraits {
113+
typedef cef_print_info_t struct_type;
114+
115+
static inline void init(struct_type* s) {}
116+
static inline void clear(struct_type* s) {}
117+
118+
static inline void set(const struct_type* src, struct_type* target,
119+
bool copy) {
120+
target->m_Scale = src->m_Scale;
121+
}
122+
};
123+
124+
///
125+
// Class representing print context information.
126+
///
127+
typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo;
128+
129+
130+
struct CefKeyInfoTraits {
131+
typedef cef_key_info_t struct_type;
132+
133+
static inline void init(struct_type* s) {}
134+
static inline void clear(struct_type* s) {}
135+
136+
static inline void set(const struct_type* src, struct_type* target,
137+
bool copy) {
138+
target->key = src->key;
139+
}
140+
};
141+
142+
///
143+
// Class representing key information.
144+
///
145+
typedef CefStructBase<CefKeyInfoTraits> CefKeyInfo;
146+
147+
#endif // OS_LINUX
148+
149+
#endif // CEF_INCLUDE_INTERNAL_CEF_LINUX_H_

0 commit comments

Comments
 (0)