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

Commit 8105512

Browse files
committed
[[ BrowserWidget ]] Further work on libbrowser.
1 parent 26ab9f0 commit 8105512

File tree

8 files changed

+900
-11
lines changed

8 files changed

+900
-11
lines changed

engine/engine.xcodeproj/project.pbxproj

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@
10071007
E82206E1184F810A00117D10 /* resolution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E82206E0184F810A00117D10 /* resolution.cpp */; };
10081008
E82206E2184F810A00117D10 /* resolution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E82206E0184F810A00117D10 /* resolution.cpp */; };
10091009
E864B42115BDAB5200F5361C /* legacy_spec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E864B41F15BDAB3F00F5361C /* legacy_spec.cpp */; };
1010+
E865FADB1AF8C5390015B20F /* libbrowser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E865FAD81AF8C5390015B20F /* libbrowser.a */; };
10101011
E8AF7D2319F7E3BF000F68E9 /* graphics_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AF7D2219F7E3BF000F68E9 /* graphics_util.cpp */; };
10111012
E8CFD7261A8236B70073D392 /* module-resources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8CFD7231A8231D10073D392 /* module-resources.cpp */; };
10121013
E8CFD7271A8236BB0073D392 /* module-resources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8CFD7231A8231D10073D392 /* module-resources.cpp */; };
@@ -1623,6 +1624,20 @@
16231624
remoteGlobalIDString = C72BED771A838B0D009B3CEB;
16241625
remoteInfo = "lc-run";
16251626
};
1627+
E865FAD71AF8C5390015B20F /* PBXContainerItemProxy */ = {
1628+
isa = PBXContainerItemProxy;
1629+
containerPortal = E8E8DE191AF1263800BAA78C /* libbrowser.xcodeproj */;
1630+
proxyType = 2;
1631+
remoteGlobalIDString = E8E8DE431AF12B6F00BAA78C;
1632+
remoteInfo = browser;
1633+
};
1634+
E865FAD91AF8C5390015B20F /* PBXContainerItemProxy */ = {
1635+
isa = PBXContainerItemProxy;
1636+
containerPortal = E8E8DE191AF1263800BAA78C /* libbrowser.xcodeproj */;
1637+
proxyType = 2;
1638+
remoteGlobalIDString = E8EA2FCA1AF3848B004D27CA;
1639+
remoteInfo = libbrowser_cefprocess;
1640+
};
16261641
/* End PBXContainerItemProxy section */
16271642

16281643
/* Begin PBXCopyFilesBuildPhase section */
@@ -2629,6 +2644,7 @@
26292644
isa = PBXFrameworksBuildPhase;
26302645
buildActionMask = 2147483647;
26312646
files = (
2647+
E865FADB1AF8C5390015B20F /* libbrowser.a in Frameworks */,
26322648
4D79B9091A3762EA00DD750C /* libkernel.a in Frameworks */,
26332649
4D79B7D41A308FFD00DD750C /* libstdscript.a in Frameworks */,
26342650
726191781A260B7F00851787 /* libscript.a in Frameworks */,
@@ -4214,6 +4230,15 @@
42144230
name = "Core - Security";
42154231
sourceTree = "<group>";
42164232
};
4233+
E8E8DE1A1AF1263800BAA78C /* Products */ = {
4234+
isa = PBXGroup;
4235+
children = (
4236+
E865FAD81AF8C5390015B20F /* libbrowser.a */,
4237+
E865FADA1AF8C5390015B20F /* libbrowser_cefprocess.app */,
4238+
);
4239+
name = Products;
4240+
sourceTree = "<group>";
4241+
};
42174242
/* End PBXGroup section */
42184243

42194244
/* Begin PBXHeadersBuildPhase section */
@@ -4749,6 +4774,20 @@
47494774
remoteRef = C7C148DD1A8B5B440048A5AE /* PBXContainerItemProxy */;
47504775
sourceTree = BUILT_PRODUCTS_DIR;
47514776
};
4777+
E865FAD81AF8C5390015B20F /* libbrowser.a */ = {
4778+
isa = PBXReferenceProxy;
4779+
fileType = archive.ar;
4780+
path = libbrowser.a;
4781+
remoteRef = E865FAD71AF8C5390015B20F /* PBXContainerItemProxy */;
4782+
sourceTree = BUILT_PRODUCTS_DIR;
4783+
};
4784+
E865FADA1AF8C5390015B20F /* libbrowser_cefprocess.app */ = {
4785+
isa = PBXReferenceProxy;
4786+
fileType = wrapper.application;
4787+
path = libbrowser_cefprocess.app;
4788+
remoteRef = E865FAD91AF8C5390015B20F /* PBXContainerItemProxy */;
4789+
sourceTree = BUILT_PRODUCTS_DIR;
4790+
};
47524791
/* End PBXReferenceProxy section */
47534792

47544793
/* Begin PBXResourcesBuildPhase section */

libbrowser/include/libbrowser.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,15 @@ class MCBrowser : public MCBrowserRefCounted
123123
class MCBrowserFactory : public MCBrowserRefCounted
124124
{
125125
public:
126+
virtual ~MCBrowserFactory() = 0;
126127
virtual bool CreateBrowser(MCBrowser *&r_browser) = 0;
127128
};
128129

129130
// C API
130131

132+
extern "C" bool MCBrowserLibraryInitialize();
133+
void MCBrowserLibraryFinalize();
134+
131135
typedef struct __MCBrowser *MCBrowserRef;
132136
typedef struct __MCBrowserFactory *MCBrowserFactoryRef;
133137

libbrowser/libbrowser.xcodeproj/project.pbxproj

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
/* Begin PBXBuildFile section */
1010
E82CC8691AF2412800E9B8B8 /* libbrowser_cef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E82CC8681AF2412800E9B8B8 /* libbrowser_cef.cpp */; };
1111
E82CC86B1AF2413E00E9B8B8 /* libbrowser_cef.h in Headers */ = {isa = PBXBuildFile; fileRef = E82CC86A1AF2413E00E9B8B8 /* libbrowser_cef.h */; };
12+
E865FADF1AF8E0DE0015B20F /* libcef_dll_wrapper.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E8EA2FEF1AF3D4BB004D27CA /* libcef_dll_wrapper.a */; };
13+
E865FAE01AF8E0DE0015B20F /* libcef_stubs.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E8EA2FF11AF3D518004D27CA /* libcef_stubs.a */; };
14+
E865FAE21AF8E5D70015B20F /* libbrowser_cef_osx.mm in Sources */ = {isa = PBXBuildFile; fileRef = E865FAE11AF8E5D70015B20F /* libbrowser_cef_osx.mm */; };
15+
E865FAE41AF8E6FA0015B20F /* WebAuthenticationPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = E865FAE31AF8E6FA0015B20F /* WebAuthenticationPanel.h */; };
1216
E8E8DE471AF12C4C00BAA78C /* libbrowser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E8DE241AF1274300BAA78C /* libbrowser.cpp */; };
1317
E8E8DE481AF12C4F00BAA78C /* libbrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = E8E8DE271AF127B400BAA78C /* libbrowser.h */; };
1418
E8EA2FEA1AF385EA004D27CA /* libbrowser_cefprocess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8EA2FC41AF383E4004D27CA /* libbrowser_cefprocess.cpp */; };
@@ -35,6 +39,8 @@
3539
/* Begin PBXFileReference section */
3640
E82CC8681AF2412800E9B8B8 /* libbrowser_cef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libbrowser_cef.cpp; sourceTree = "<group>"; };
3741
E82CC86A1AF2413E00E9B8B8 /* libbrowser_cef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libbrowser_cef.h; sourceTree = "<group>"; };
42+
E865FAE11AF8E5D70015B20F /* libbrowser_cef_osx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = libbrowser_cef_osx.mm; sourceTree = "<group>"; };
43+
E865FAE31AF8E6FA0015B20F /* WebAuthenticationPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanel.h; sourceTree = "<group>"; };
3844
E8E8DE201AF126B000BAA78C /* Global.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = Global.xcconfig; path = ../rules/Global.xcconfig; sourceTree = "<group>"; };
3945
E8E8DE211AF126B000BAA78C /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = ../rules/Release.xcconfig; sourceTree = "<group>"; };
4046
E8E8DE221AF126B000BAA78C /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = ../rules/Debug.xcconfig; sourceTree = "<group>"; };
@@ -57,6 +63,8 @@
5763
isa = PBXFrameworksBuildPhase;
5864
buildActionMask = 2147483647;
5965
files = (
66+
E865FADF1AF8E0DE0015B20F /* libcef_dll_wrapper.a in Frameworks */,
67+
E865FAE01AF8E0DE0015B20F /* libcef_stubs.a in Frameworks */,
6068
);
6169
runOnlyForDeploymentPostprocessing = 0;
6270
};
@@ -105,9 +113,11 @@
105113
E8E8DE241AF1274300BAA78C /* libbrowser.cpp */,
106114
E82CC8681AF2412800E9B8B8 /* libbrowser_cef.cpp */,
107115
E82CC86A1AF2413E00E9B8B8 /* libbrowser_cef.h */,
116+
E865FAE11AF8E5D70015B20F /* libbrowser_cef_osx.mm */,
108117
E8EA2FC41AF383E4004D27CA /* libbrowser_cefprocess.cpp */,
109-
E8EA2FF51AF3D865004D27CA /* libbrowser_cefshared_osx.cpp */,
110118
E8EA2FFA1AF3D91C004D27CA /* libbrowser_cefprocess_osx.mm */,
119+
E8EA2FF51AF3D865004D27CA /* libbrowser_cefshared_osx.cpp */,
120+
E865FAE31AF8E6FA0015B20F /* WebAuthenticationPanel.h */,
111121
);
112122
name = Source;
113123
path = src;
@@ -139,6 +149,7 @@
139149
buildActionMask = 2147483647;
140150
files = (
141151
E82CC86B1AF2413E00E9B8B8 /* libbrowser_cef.h in Headers */,
152+
E865FAE41AF8E6FA0015B20F /* WebAuthenticationPanel.h in Headers */,
142153
E8E8DE481AF12C4F00BAA78C /* libbrowser.h in Headers */,
143154
);
144155
runOnlyForDeploymentPostprocessing = 0;
@@ -231,6 +242,7 @@
231242
isa = PBXSourcesBuildPhase;
232243
buildActionMask = 2147483647;
233244
files = (
245+
E865FAE21AF8E5D70015B20F /* libbrowser_cef_osx.mm in Sources */,
234246
E8E8DE471AF12C4C00BAA78C /* libbrowser.cpp in Sources */,
235247
E82CC8691AF2412800E9B8B8 /* libbrowser_cef.cpp in Sources */,
236248
E8EA2FF61AF3D865004D27CA /* libbrowser_cefshared_osx.cpp in Sources */,
@@ -285,13 +297,21 @@
285297
E8E8DE451AF12B6F00BAA78C /* Debug */ = {
286298
isa = XCBuildConfiguration;
287299
buildSettings = {
300+
LIBRARY_SEARCH_PATHS = (
301+
"$(inherited)",
302+
/Users/ianmacphail/workspace/livecode/btsync/widget/livecode/_build/mac/Debug,
303+
);
288304
PRODUCT_NAME = browser;
289305
};
290306
name = Debug;
291307
};
292308
E8E8DE461AF12B6F00BAA78C /* Release */ = {
293309
isa = XCBuildConfiguration;
294310
buildSettings = {
311+
LIBRARY_SEARCH_PATHS = (
312+
"$(inherited)",
313+
/Users/ianmacphail/workspace/livecode/btsync/widget/livecode/_build/mac/Debug,
314+
);
295315
PRODUCT_NAME = browser;
296316
};
297317
name = Release;
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright
11+
* notice, this list of conditions and the following disclaimer in the
12+
* documentation and/or other materials provided with the distribution.
13+
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14+
* its contributors may be used to endorse or promote products derived
15+
* from this software without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
29+
#import <Cocoa/Cocoa.h>
30+
#import <Foundation/NSURLCredentialStorage.h>
31+
32+
@class NSURLAuthenticationChallenge;
33+
34+
@interface com_runrev_livecode_WebAuthenticationPanel : NSObject
35+
{
36+
IBOutlet id mainLabel;
37+
IBOutlet id panel;
38+
IBOutlet id password;
39+
IBOutlet id smallLabel;
40+
IBOutlet id username;
41+
IBOutlet id imageView;
42+
IBOutlet id remember;
43+
IBOutlet NSTextField *separateRealmLabel;
44+
BOOL nibLoaded;
45+
BOOL usingSheet;
46+
id callback;
47+
SEL selector;
48+
NSURLAuthenticationChallenge *challenge;
49+
}
50+
51+
-(id)initWithCallback:(id)cb selector:(SEL)sel;
52+
53+
// Interface-related methods
54+
- (IBAction)cancel:(id)sender;
55+
- (IBAction)logIn:(id)sender;
56+
57+
- (BOOL)loadNib;
58+
59+
- (void)runAsModalDialogWithChallenge:(NSURLAuthenticationChallenge *)chall;
60+
- (void)runAsSheetOnWindow:(NSWindow *)window withChallenge:(NSURLAuthenticationChallenge *)chall;
61+
62+
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
63+
64+
@end
65+
66+
// This is in the header so it can be used from the nib file
67+
@interface NonBlockingPanel : NSPanel
68+
@end
69+

libbrowser/src/libbrowser.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,33 @@ void MCBrowser::OnJavaScriptCall(const char *p_handler, uint32_t p_arg_count, co
105105
m_javascript_handler->OnJavaScriptCall(this, p_handler, p_arg_count, p_args);
106106
}
107107

108+
// Init functions
109+
110+
static MCBrowserFactoryRef s_browser_factory = nil;
111+
112+
extern bool MCCefBrowserFactoryCreate(MCBrowserFactoryRef &r_factory);
113+
bool MCBrowserLibraryInitialize()
114+
{
115+
s_browser_factory = nil;
116+
return MCCefBrowserFactoryCreate(s_browser_factory);
117+
}
118+
119+
void MCBrowserLibraryFinalize()
120+
{
121+
if (s_browser_factory)
122+
delete (MCBrowserFactory*)s_browser_factory;
123+
}
124+
108125
// Factory
109126

110127
bool MCBrowserFactoryGet(const char *p_factory, MCBrowserFactoryRef &r_factory)
111128
{
112129
// TODO - platform specific implementation
130+
if (s_browser_factory == nil)
131+
return false;
132+
133+
r_factory = s_browser_factory;
134+
return true;
113135
}
114136

115137
bool MCBrowserFactoryCreateBrowser(MCBrowserFactoryRef p_factory, MCBrowserRef &r_browser)

0 commit comments

Comments
 (0)