Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit be16d4e

Browse files
committed
[[ LibCef ]] Update cefbrowser to use libcef3 release 2062
1 parent da5065c commit be16d4e

9 files changed

Lines changed: 149 additions & 97 deletions

File tree

prebuilt

revbrowser/revbrowser.xcodeproj/project.pbxproj

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
E8589AF018C9F82200958234 /* cefbrowser_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = E8589AEF18C9F82200958234 /* cefbrowser_osx.mm */; };
2424
E8589D9B18CA20CF00958234 /* libcef_dll_wrapper.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AA04C018C9E72A00AE8663 /* libcef_dll_wrapper.a */; };
2525
E858A20E18CDD1FB00958234 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E858A20D18CDD1FB00958234 /* AppKit.framework */; };
26-
E897315018D07D2A005FFFBE /* Resources in CopyFiles */ = {isa = PBXBuildFile; fileRef = E897308018D07D1D005FFFBE /* Resources */; };
26+
E8C36969199901F4005241FB /* cefshared_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8C36967199901F4005241FB /* cefshared_osx.cpp */; };
27+
E8C3698B199903B8005241FB /* cefshared_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8C36967199901F4005241FB /* cefshared_osx.cpp */; };
28+
E8C369D3199A2E0D005241FB /* Chromium Embedded Framework.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = E8C369CB199A2B3B005241FB /* Chromium Embedded Framework.framework */; };
2729
E8D3736118CDDA5A005C1182 /* cefprocess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8D3736018CDDA5A005C1182 /* cefprocess.cpp */; };
2830
E8D3736A18CDDBEE005C1182 /* cefprocess_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = E8D3736918CDDBEE005C1182 /* cefprocess_osx.mm */; };
2931
E8D373BF18CDE872005C1182 /* libcef_dll_wrapper.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E8AA04C018C9E72A00AE8663 /* libcef_dll_wrapper.a */; };
@@ -119,13 +121,13 @@
119121
/* End PBXContainerItemProxy section */
120122

121123
/* Begin PBXCopyFilesBuildPhase section */
122-
E8D3787718CF44C0005C1182 /* CopyFiles */ = {
124+
E8C369D2199A2DFB005241FB /* CopyFiles */ = {
123125
isa = PBXCopyFilesBuildPhase;
124126
buildActionMask = 2147483647;
125-
dstPath = "revbrowser-cefprocess.app/Contents/Frameworks/Chromium Embedded Framework.framework";
127+
dstPath = Frameworks;
126128
dstSubfolderSpec = 16;
127129
files = (
128-
E897315018D07D2A005FFFBE /* Resources in CopyFiles */,
130+
E8C369D3199A2E0D005241FB /* Chromium Embedded Framework.framework in CopyFiles */,
129131
);
130132
runOnlyForDeploymentPostprocessing = 0;
131133
};
@@ -158,10 +160,11 @@
158160
E8589AD918C9F77800958234 /* cefbrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cefbrowser.h; path = src/cefbrowser.h; sourceTree = "<group>"; };
159161
E8589AEF18C9F82200958234 /* cefbrowser_osx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = cefbrowser_osx.mm; path = src/cefbrowser_osx.mm; sourceTree = "<group>"; };
160162
E8589AF118C9F84000958234 /* cefprocess_w32.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cefprocess_w32.cpp; path = src/cefprocess_w32.cpp; sourceTree = "<group>"; };
161-
E858A19D18CA29F800958234 /* libcef.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcef.dylib; path = ../prebuilt/lib/libcef/mac/libcef.dylib; sourceTree = SOURCE_ROOT; };
162163
E858A20D18CDD1FB00958234 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
163-
E897308018D07D1D005FFFBE /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Resources; path = ../prebuilt/lib/libcef/mac/Resources; sourceTree = SOURCE_ROOT; };
164164
E8AA049B18C9E6DD00AE8663 /* libcef_dll_wrapper.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libcef_dll_wrapper.xcodeproj; path = ../thirdparty/libcef/libcef_dll_wrapper.xcodeproj; sourceTree = SOURCE_ROOT; };
165+
E8C36967199901F4005241FB /* cefshared_osx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cefshared_osx.cpp; path = src/cefshared_osx.cpp; sourceTree = "<group>"; };
166+
E8C36968199901F4005241FB /* cefshared.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cefshared.h; path = src/cefshared.h; sourceTree = "<group>"; };
167+
E8C369CB199A2B3B005241FB /* Chromium Embedded Framework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "Chromium Embedded Framework.framework"; path = "../prebuilt/lib/libcef/mac/Chromium Embedded Framework.framework"; sourceTree = "<group>"; };
165168
E8D371CC18CDD2D7005C1182 /* libcore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libcore.xcodeproj; path = ../libcore/libcore.xcodeproj; sourceTree = SOURCE_ROOT; };
166169
E8D3735718CDDA3F005C1182 /* revbrowser-cefprocess.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "revbrowser-cefprocess.app"; sourceTree = BUILT_PRODUCTS_DIR; };
167170
E8D3735918CDDA40005C1182 /* revbrowser-cefprocess-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "revbrowser-cefprocess-Info.plist"; sourceTree = "<group>"; };
@@ -205,14 +208,13 @@
205208
isa = PBXGroup;
206209
children = (
207210
E858A20D18CDD1FB00958234 /* AppKit.framework */,
208-
E858A19D18CA29F800958234 /* libcef.dylib */,
209211
769568ED1823D0E700779255 /* libcore.a */,
212+
E8C369CB199A2B3B005241FB /* Chromium Embedded Framework.framework */,
210213
4D03BCBB0BC2785100026EA7 /* WebKit.framework */,
211214
4D03BCB40BC2783300026EA7 /* Cocoa.framework */,
212215
4D03BCAC0BC2781B00026EA7 /* Carbon.framework */,
213216
4D03BCA40BC2780100026EA7 /* Foundation.framework */,
214217
4DF42AD90B04899A003F2D95 /* References */,
215-
E8589F2418CA22D200958234 /* Resources */,
216218
4DF42AAF0B0488D7003F2D95 /* Source */,
217219
4DF42AA30B0488B6003F2D95 /* Configurations */,
218220
4DF42AA90B0488CE003F2D95 /* Products */,
@@ -281,14 +283,6 @@
281283
name = Products;
282284
sourceTree = "<group>";
283285
};
284-
E8589F2418CA22D200958234 /* Resources */ = {
285-
isa = PBXGroup;
286-
children = (
287-
E897308018D07D1D005FFFBE /* Resources */,
288-
);
289-
name = Resources;
290-
sourceTree = "<group>";
291-
};
292286
E8AA04B718C9E72A00AE8663 /* Products */ = {
293287
isa = PBXGroup;
294288
children = (
@@ -319,6 +313,8 @@
319313
E8589AD818C9F77800958234 /* cefbrowser.cpp */,
320314
E8589AEF18C9F82200958234 /* cefbrowser_osx.mm */,
321315
E8D3736418CDDA9B005C1182 /* cefbrowser_w32.cpp */,
316+
E8C36967199901F4005241FB /* cefshared_osx.cpp */,
317+
E8C36968199901F4005241FB /* cefshared.h */,
322318
);
323319
name = CEF;
324320
sourceTree = "<group>";
@@ -355,8 +351,9 @@
355351
E8D3735318CDDA3F005C1182 /* Resources */,
356352
E8D3735418CDDA3F005C1182 /* Sources */,
357353
E8D3735518CDDA3F005C1182 /* Frameworks */,
358-
E8D3787718CF44C0005C1182 /* CopyFiles */,
359354
E812E09E196AFE3A001F6EC4 /* ShellScript */,
355+
E8C369D2199A2DFB005241FB /* CopyFiles */,
356+
E8C369D5199A2E7F005241FB /* ShellScript */,
360357
);
361358
buildRules = (
362359
);
@@ -375,6 +372,8 @@
375372
/* Begin PBXProject section */
376373
4DF42A990B0488B2003F2D95 /* Project object */ = {
377374
isa = PBXProject;
375+
attributes = {
376+
};
378377
buildConfigurationList = 4DF42A9A0B0488B2003F2D95 /* Build configuration list for PBXProject "revbrowser" */;
379378
compatibilityVersion = "Xcode 3.2";
380379
developmentRegion = English;
@@ -477,6 +476,19 @@
477476
shellPath = /bin/sh;
478477
shellScript = "exec tools/make_more_helpers.sh";
479478
};
479+
E8C369D5199A2E7F005241FB /* ShellScript */ = {
480+
isa = PBXShellScriptBuildPhase;
481+
buildActionMask = 2147483647;
482+
files = (
483+
);
484+
inputPaths = (
485+
);
486+
outputPaths = (
487+
);
488+
runOnlyForDeploymentPostprocessing = 0;
489+
shellPath = /bin/sh;
490+
shellScript = "FRAMEWORKS_DIR=${CONFIGURATION_BUILD_DIR}/Frameworks\n\ncp -r \"${CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME}.app\" \"${FRAMEWORKS_DIR}\"\ncp -r \"${CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME} EH.app\" \"${FRAMEWORKS_DIR}\"\ncp -r \"${CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME} NP.app\" \"${FRAMEWORKS_DIR}\"\n";
491+
};
480492
/* End PBXShellScriptBuildPhase section */
481493

482494
/* Begin PBXSourcesBuildPhase section */
@@ -488,6 +500,7 @@
488500
E8589ADA18C9F77800958234 /* cefbrowser.cpp in Sources */,
489501
E8589AF018C9F82200958234 /* cefbrowser_osx.mm in Sources */,
490502
E832B1B618D9C3C100083DF8 /* osxbrowser.cpp in Sources */,
503+
E8C36969199901F4005241FB /* cefshared_osx.cpp in Sources */,
491504
E857DDAB19081FAA002714D6 /* WebAuthenticationPanel.m in Sources */,
492505
);
493506
runOnlyForDeploymentPostprocessing = 0;
@@ -497,6 +510,7 @@
497510
buildActionMask = 2147483647;
498511
files = (
499512
E8D3736118CDDA5A005C1182 /* cefprocess.cpp in Sources */,
513+
E8C3698B199903B8005241FB /* cefshared_osx.cpp in Sources */,
500514
E8D3736A18CDDBEE005C1182 /* cefprocess_osx.mm in Sources */,
501515
);
502516
runOnlyForDeploymentPostprocessing = 0;

revbrowser/src/cefbrowser.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
2020

2121
#include "cefbrowser.h"
2222
#include "cefbrowser_msg.h"
23+
#include "cefshared.h"
2324

2425
#include <include/cef_app.h>
2526

@@ -179,10 +180,10 @@ bool MCCefInitialise(void)
179180
CefRefPtr<CefApp> t_app = nil;
180181

181182
if (t_success)
182-
t_success = -1 == CefExecuteProcess(t_args, t_app);
183+
t_success = -1 == CefExecuteProcess(t_args, t_app, nil);
183184

184185
if (t_success)
185-
t_success = CefInitialize(t_args, t_settings, t_app);
186+
t_success = CefInitialize(t_args, t_settings, t_app, nil);
186187

187188
s_cef_initialised = t_success;
188189

@@ -558,9 +559,6 @@ class MCCefBrowserClient : public CefClient, CefLifeSpanHandler, CefRequestHandl
558559
// We handle browser closing here to stop CEF sending WM_CLOSE to the stack window
559560
if (p_browser->GetIdentifier() == m_browser_id)
560561
{
561-
// Inform the browser that it's window will close
562-
p_browser->GetHost()->ParentWindowWillClose();
563-
564562
// Close the browser window
565563
MCCefPlatformCloseBrowserWindow(p_browser);
566564

revbrowser/src/cefbrowser.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ class MCCefBrowserBase : public CWebBrowserBase
177177

178178
bool MCCefPlatformCreateBrowser(int p_window_id, MCCefBrowserBase *&r_browser);
179179
void MCCefPlatformCloseBrowserWindow(CefRefPtr<CefBrowser> p_browser);
180+
180181
const char *MCCefPlatformGetSubProcessName(void);
181-
const char *MCCefPlatformGetCefLibraryPath(void);
182-
const char *MCCefPlatformGetLocalePath(void);
183182

184183
bool MCCefStringToCString(const CefString &p_cef_string, char *&r_c_string);
185184
bool MCCefStringFromCString(const char *p_c_string, CefString &r_cef_string);

revbrowser/src/cefbrowser_osx.mm

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -101,73 +101,42 @@ bool MCCefStringToNSString(const CefString &p_string, NSString *&r_string)
101101
int32_t m_left, m_top, m_right, m_bottom;
102102
};
103103

104+
// IM-2014-08-12: [[ LibCef ]] helper app located in Frameworks folder of main app bundle.
104105
const char *MCCefPlatformGetSubProcessName(void)
105106
{
106107
static char *s_exe_path = nil;
107108

108109
if (s_exe_path == nil)
109110
{
110111
NSBundle *t_bundle;
111-
t_bundle = [NSBundle bundleWithIdentifier:@"com.runrev.revbrowser"];
112+
t_bundle = [NSBundle mainBundle];
112113

113-
NSString *t_parent_path;
114-
t_parent_path = [[t_bundle bundlePath] stringByDeletingLastPathComponent];
114+
NSString *t_path;
115+
t_path = [[t_bundle bundlePath] stringByAppendingPathComponent:@"Contents/Frameworks/revbrowser-cefprocess.app/Contents/MacOS/revbrowser-cefprocess"];
115116

116-
char *t_exe_path;
117-
t_exe_path = nil;
118-
119-
// IM-2014-03-25: [[ revBrowserCEF ]] Look for subprocess executable in CEF subfolder
120-
bool t_success;
121-
t_success = MCCStringClone([t_parent_path cStringUsingEncoding:NSUTF8StringEncoding], t_exe_path);
122-
if (t_success)
123-
t_success = MCCStringAppend(t_exe_path,
124-
"/CEF/revbrowser-cefprocess.app/Contents/MacOS/revbrowser-cefprocess");
125-
126-
if (t_success)
127-
s_exe_path = t_exe_path;
128-
else if (t_exe_path != nil)
129-
MCCStringFree(t_exe_path);
117+
/* UNCHECKED */ MCCStringClone([t_path cStringUsingEncoding:NSUTF8StringEncoding], s_exe_path);
130118
}
131119

132120
return s_exe_path;
133121
}
134122

135-
// IM-2014-03-25: [[ revBrowserCEF ]] Return the path to the libcef.dylib library file
136-
// located in CEF subfolder beside the revbrowser bundle
137-
const char *MCCefPlatformGetCefLibraryPath(void)
123+
// IM-2014-08-12: [[ LibCef ]] CEF framework folder located in Frameworks folder of main app bundle.
124+
const char *MCCefPlatformGetCefFrameworkFolder()
138125
{
139-
static char *s_lib_path = nil;
126+
static char *s_path = nil;
140127

141-
if (s_lib_path == nil)
128+
if (s_path == nil)
142129
{
143130
NSBundle *t_bundle;
144-
t_bundle = [NSBundle bundleWithIdentifier:@"com.runrev.revbrowser"];
145-
146-
NSString *t_parent_path;
147-
t_parent_path = [[t_bundle bundlePath] stringByDeletingLastPathComponent];
148-
149-
char *t_path;
150-
t_path = nil;
131+
t_bundle = [NSBundle mainBundle];
151132

152-
bool t_success;
153-
t_success = MCCStringClone([t_parent_path cStringUsingEncoding:NSUTF8StringEncoding], t_path);
154-
if (t_success)
155-
t_success = MCCStringAppend(t_path,
156-
"/CEF/libcef.dylib");
133+
NSString *t_cef_path;
134+
t_cef_path = [[t_bundle bundlePath] stringByAppendingPathComponent:@"Contents/Frameworks/Chromium Embedded Framework.framework"];
157135

158-
if (t_success)
159-
s_lib_path = t_path;
160-
else if (t_path != nil)
161-
MCCStringFree(t_path);
136+
/* UNCHECKED */ MCCStringClone([t_cef_path cStringUsingEncoding:NSUTF8StringEncoding], s_path);
162137
}
163138

164-
return s_lib_path;
165-
}
166-
167-
// IM-2014-03-25: [[ revBrowserCEF ]] Can't change the locale path on OSX so return nil
168-
const char *MCCefPlatformGetLocalePath(void)
169-
{
170-
return nil;
139+
return s_path;
171140
}
172141

173142
bool MCCefPlatformCreateBrowser(int p_window_id, MCCefBrowserBase *&r_browser)

revbrowser/src/cefprocess_osx.mm

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
#include <AppKit/AppKit.h>
2222

23+
#include "cefshared.h"
24+
2325
////////////////////////////////////////////////////////////////////////////////
2426

2527
extern bool MCCefCreateApp(CefRefPtr<CefApp> &r_app);
@@ -29,48 +31,44 @@
2931
extern "C" int initialise_weak_link_cef(void);
3032
extern "C" int initialise_weak_link_cef_with_path(const char *p_path);
3133

32-
int main(int argc, char *argv[])
34+
// IM-2014-08-12: [[ LibCef ]] cef Framework folder located in same folder as helper app.
35+
const char *MCCefPlatformGetCefFrameworkFolder()
3336
{
34-
// IM-2014-03-21: [[ revBrowserCEF ]] Look for libcef.dylib library in containing bundle
35-
// IM-2014-03-25: [[ revBrowserCEF ]] cef library located in same folder as this app bundle
36-
NSAutoreleasePool *t_pool;
37-
t_pool = [[NSAutoreleasePool alloc] init];
37+
static char *s_path = nil;
3838

39-
NSString *t_bundle_path;
40-
t_bundle_path = [[NSBundle mainBundle] bundlePath];
39+
if (s_path == nil)
40+
{
41+
NSBundle *t_bundle;
42+
t_bundle = [NSBundle mainBundle];
43+
44+
NSString *t_cef_path;
45+
t_cef_path = [[[ t_bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Chromium Embedded Framework.framework"];
46+
47+
/* UNCHECKED */ MCCStringClone([t_cef_path cStringUsingEncoding:NSUTF8StringEncoding], s_path);
48+
}
4149

42-
// Split path into components
43-
NSMutableArray *t_components;
44-
t_components = [[t_bundle_path pathComponents] mutableCopy];
50+
return s_path;
51+
}
4552

46-
// Remove "revbrowser-cefprocess.app" path component
47-
[t_components removeLastObject];
48-
49-
// Add library name path component
50-
[t_components addObject: @"libcef.dylib"];
51-
52-
// Rebuild path
53-
NSString *t_lib_path;
54-
t_lib_path = [NSString pathWithComponents:t_components];
55-
56-
const char *t_c_path;
57-
t_c_path = [t_lib_path cStringUsingEncoding:NSUTF8StringEncoding];
53+
int main(int argc, char *argv[])
54+
{
55+
const char *t_lib_path;
56+
t_lib_path = MCCefPlatformGetCefLibraryPath();
5857

5958
// IM-2014-03-19: [[ revBrowserCEF ]] Initialise dynamically loaded cef library
60-
if (!initialise_weak_link_cef_with_path(t_c_path) && !initialise_weak_link_cef())
59+
if (!initialise_weak_link_cef_with_path(t_lib_path) && !initialise_weak_link_cef())
6160
{
62-
printf("failed to load libcef library: %s", t_c_path);
61+
printf("failed to load libcef library: %s", t_lib_path);
6362
return -1;
6463
}
65-
[t_pool release];
6664

6765
CefMainArgs t_args(argc, argv);
6866

6967
CefRefPtr<CefApp> t_app;
7068
if (!MCCefCreateApp(t_app))
7169
return -1;
7270

73-
return CefExecuteProcess(t_args, t_app);
71+
return CefExecuteProcess(t_args, t_app, nil);
7472
}
7573

7674
////////////////////////////////////////////////////////////////////////////////

revbrowser/src/cefshared.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* Copyright (C) 2003-2013 Runtime Revolution Ltd.
2+
3+
This file is part of LiveCode.
4+
5+
LiveCode is free software; you can redistribute it and/or modify it under
6+
the terms of the GNU General Public License v3 as published by the Free
7+
Software Foundation.
8+
9+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
10+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
16+
17+
#ifndef __MCCEF_SHARED_H__
18+
#define __MCCEF_SHARED_H__
19+
20+
const char *MCCefPlatformGetCefLibraryPath(void);
21+
const char *MCCefPlatformGetResourcesDirPath(void);
22+
const char *MCCefPlatformGetLocalePath(void);
23+
24+
#endif // __MCCEF_SHARED_H__

0 commit comments

Comments
 (0)