Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

work on mac!

  • Loading branch information...
commit 7ce9669b66ce0026846758574c3df5d95dd8cd38 1 parent 441aceb
xue yong zhi authored
View
BIN  Debug/ffmpegsumo.so
Binary file not shown
View
BIN  Debug/libcef.dylib
Binary file not shown
View
BIN  Release/ffmpegsumo.so
Binary file not shown
View
BIN  Release/libcef.dylib
Binary file not shown
View
21 cefclient.xcodeproj/project.pbxproj
@@ -98,6 +98,9 @@
E99A95613184A025DAEA286C /* keyboard_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 748CD485E6DBA8771E01E5E2 /* keyboard_handler_cpptoc.cc */; };
EAE5586ADBEA5E1D5F7ED44F /* libcef.dylib in Copy to $(BUILT_PRODUCTS_DIR)/cefclient.app/Contents/MacOS/ */ = {isa = PBXBuildFile; fileRef = 14C755C1706AFCF7A5AA44A3 /* libcef.dylib */; };
ECC9EF70F296DE3E9F70106D /* domnode_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 56DC839EE86346F6EAEAF36F /* domnode_ctocpp.cc */; };
+ EE88AEFC14DB0C7000FEE8BE /* fs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EE88AEF714DB0C7000FEE8BE /* fs.cpp */; };
+ EE88AEFD14DB0C7000FEE8BE /* os.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EE88AEF914DB0C7000FEE8BE /* os.cpp */; };
+ EE88AEFE14DB0C7000FEE8BE /* win.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EE88AEFB14DB0C7000FEE8BE /* win.cpp */; };
F3BAACF00A229A5046FB6730 /* v8context_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = F0483A2D1EF7742AAEA38A6B /* v8context_handler_cpptoc.cc */; };
F51F396A529181C4D800F829 /* v8exception_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 468ECAB6532CF48FA751A0C9 /* v8exception_ctocpp.cc */; };
F8F4B865CFA5B5AB951C2E5E /* domaccess.html in Resources */ = {isa = PBXBuildFile; fileRef = 6A6A2607997BE401DC42DCDF /* domaccess.html */; };
@@ -326,6 +329,11 @@
EB9586A7A5CCEB4F8AEFFF45 /* client_popup_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_popup_handler.h; sourceTree = "<group>"; };
EC3142E0CA8C521B3F746771 /* cefclient.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cefclient.icns; sourceTree = "<group>"; };
ED7DA8E7BE98EB9E02A3ABD8 /* domevent_listener_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_listener_cpptoc.cc; sourceTree = "<group>"; };
+ EE88AEF714DB0C7000FEE8BE /* fs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fs.cpp; path = ext/fs.cpp; sourceTree = "<group>"; };
+ EE88AEF814DB0C7000FEE8BE /* fs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fs.h; path = ext/fs.h; sourceTree = "<group>"; };
+ EE88AEF914DB0C7000FEE8BE /* os.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = os.cpp; path = ext/os.cpp; sourceTree = "<group>"; };
+ EE88AEFA14DB0C7000FEE8BE /* os.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = os.h; path = ext/os.h; sourceTree = "<group>"; };
+ EE88AEFB14DB0C7000FEE8BE /* win.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = win.cpp; path = ext/win.cpp; sourceTree = "<group>"; };
EEEFD38CF535C24F947446E4 /* post_data_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = post_data_ctocpp.h; sourceTree = "<group>"; };
F0483A2D1EF7742AAEA38A6B /* v8context_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8context_handler_cpptoc.cc; sourceTree = "<group>"; };
F3822D62F6FF4FC5B936914A /* cef_nplugin_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_nplugin_capi.h; sourceTree = "<group>"; };
@@ -535,6 +543,11 @@
76C4A3729C2ADEFA4DA93863 /* cefclient */ = {
isa = PBXGroup;
children = (
+ EE88AEF714DB0C7000FEE8BE /* fs.cpp */,
+ EE88AEF814DB0C7000FEE8BE /* fs.h */,
+ EE88AEF914DB0C7000FEE8BE /* os.cpp */,
+ EE88AEFA14DB0C7000FEE8BE /* os.h */,
+ EE88AEFB14DB0C7000FEE8BE /* win.cpp */,
57338A9AD1F426E475F2A4CA /* mac */,
4EBA993052482FD2D4F643A9 /* res */,
BDFDD7C41EA28111EEFAD317 /* cefclient.cpp */,
@@ -701,12 +714,13 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
};
- buildConfigurationList = 5627BAF721B148130D750A27 /* Build configuration list for PBXProject "h54d" */;
+ buildConfigurationList = 5627BAF721B148130D750A27 /* Build configuration list for PBXProject "cefclient" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
+ English,
);
mainGroup = C93C9288CEA74098FF733D84;
projectDirPath = "";
@@ -787,6 +801,9 @@
04FD9135645A80EE5B2DDFEE /* cefclient_mac.mm in Sources */,
8B17B72C33188DC68DD89434 /* client_handler_mac.mm in Sources */,
B603CBCC8D36CE20C9E62E67 /* resource_util_mac.mm in Sources */,
+ EE88AEFC14DB0C7000FEE8BE /* fs.cpp in Sources */,
+ EE88AEFD14DB0C7000FEE8BE /* os.cpp in Sources */,
+ EE88AEFE14DB0C7000FEE8BE /* win.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1191,7 +1208,7 @@
defaultConfigurationIsVisible = 1;
defaultConfigurationName = Debug;
};
- 5627BAF721B148130D750A27 /* Build configuration list for PBXProject "h54d" */ = {
+ 5627BAF721B148130D750A27 /* Build configuration list for PBXProject "cefclient" */ = {
isa = XCConfigurationList;
buildConfigurations = (
81FDA1D67313979CBCD0ED45 /* Debug */,
View
2  cefclient/cefclient.cpp
@@ -217,7 +217,7 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<CefApp>& app)
// Retrieve command-line proxy configuration, if any.
bool has_proxy = false;
- cef_proxy_type_t proxy_type;
+ cef_proxy_type_t proxy_type = PROXY_TYPE_DIRECT;
CefString proxy_config;
if (g_command_line->HasSwitch(cefclient::kProxyType)) {
View
6 cefclient/cefclient_mac.mm
@@ -12,6 +12,9 @@
#import <Cocoa/Cocoa.h>
#include <sstream>
+#include "ext/os.h"
+#include "ext/fs.h"
+
// The global ClientHandler reference.
extern CefRefPtr<ClientHandler> g_handler;
@@ -217,6 +220,9 @@ - (void)createApp:(id)object {
AppGetBrowserSettings(settings);
window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight);
+
+ OS::Initialize();
+ FS::Initialize();
NSString *currentpath = [[[[NSBundle mainBundle] bundlePath] stringByDeletingPathExtension] stringByDeletingLastPathComponent];
NSString *fileName = [NSString stringWithFormat:@"file:///%@/%@",currentpath,@"index.htm"];
View
64 cefclient/ext/fs.cpp
@@ -2,12 +2,23 @@
#include "include/cef.h"
#include "include/cef_runnable.h"
+#ifdef WIN32
#include <io.h>
+#else
+#define _open open
+#define _close close
+#define _O_RDWR O_RDWR
+#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sstream>
+#ifndef WIN32
+#undef OVERRIDE
+#define OVERRIDE
+#endif
+
CefRefPtr<CefV8Value> fs_open(const CefV8ValueList& arguments)
{
if (arguments.size() != 2)
@@ -16,7 +27,7 @@ CefRefPtr<CefV8Value> fs_open(const CefV8ValueList& arguments)
const CefString& filename = arguments[0]->GetStringValue();
int mode = _O_RDWR;
- int fd = _wopen(filename.c_str(), mode);
+ int fd = _open(filename.ToString().c_str(), mode);
return CefV8Value::CreateInt(fd);
}
@@ -37,33 +48,32 @@ CefRefPtr<CefV8Value> fs_readFile(const CefV8ValueList& arguments)
{
if (arguments.size() != 2)
return CefV8Value::CreateNull();
-
- if (!(arguments[0]->IsString())) {
- return CefV8Value::CreateNull();
+
+ if (!(arguments[0]->IsString())) {
+ return CefV8Value::CreateNull();
+ }
+
+ if (!(arguments[1]->IsFunction())) {
+ return CefV8Value::CreateNull();
}
- if (!(arguments[1]->IsFunction())) {
- return CefV8Value::CreateNull();
- }
-
- CefString path = arguments[0]->GetStringValue();
- const wchar_t* path_s = path.c_str();
- FILE *f = _wfopen(path_s, L"r" );
- if (NULL == f) {
- return CefV8Value::CreateNull();
- }
-
- std::stringstream str;
- char buff[1024] = {0};
- int n;
- while ((n = fread(buff, 1, sizeof(buff) - 1, f)) > 0) {
- buff[n] = '\0';
- str << buff;
- }
- fclose(f);
-
- CefRefPtr<CefV8Value> callback_func = arguments[1];
- CefRefPtr<CefV8Value> retval;
+ CefString path = arguments[0]->GetStringValue();
+ FILE *f = fopen(path.ToString().c_str(), "r" );
+ if (NULL == f) {
+ return CefV8Value::CreateNull();
+ }
+
+ std::stringstream str;
+ char buff[1024] = {0};
+ int n;
+ while ((n = fread(buff, 1, sizeof(buff) - 1, f)) > 0) {
+ buff[n] = '\0';
+ str << buff;
+ }
+ fclose(f);
+
+ CefRefPtr<CefV8Value> callback_func = arguments[1];
+ CefRefPtr<CefV8Value> retval;
CefRefPtr<CefV8Exception> exception;
CefV8ValueList args;
args.push_back(CefV8Value::CreateNull());
@@ -130,4 +140,4 @@ void FS::Initialize()
// Register the extension.
CefRegisterExtension("v8/fs", extensionCode, handler);
-}
+}
View
2  cefclient/ext/fs.h
@@ -6,4 +6,4 @@ class FS {
static void Initialize ();
};
-#endif
+#endif
View
13 cefclient/ext/os.cpp
@@ -2,7 +2,12 @@
#include "include/cef.h"
#include "include/cef_runnable.h"
-extern CefRefPtr<CefV8Value> getNetworkInterface();
+#ifndef WIN32
+#undef OVERRIDE
+#define OVERRIDE
+#endif
+
+//extern CefRefPtr<CefV8Value> getNetworkInterface();
class MyV8Handler : public CefV8Handler
{
@@ -15,11 +20,11 @@ class MyV8Handler : public CefV8Handler
CefRefPtr<CefV8Value>& retval,
CefString& exception) OVERRIDE
{
- if (name == "networkInterfaces") {
+ /*if (name == "networkInterfaces") {
// Return my string value.
retval = getNetworkInterface();
return true;
- }
+ }*/
// Function does not exist.
return false;
@@ -53,4 +58,4 @@ void OS::Initialize()
// Register the extension.
CefRegisterExtension("v8/os", extensionCode, handler);
-}
+}
View
2  cefclient/ext/os.h
@@ -6,4 +6,4 @@ class OS {
static void Initialize ();
};
-#endif
+#endif
View
2  cefclient/ext/win.cpp
@@ -143,4 +143,4 @@ CefRefPtr<CefV8Value> getNetworkInterface()
*/
-#endif //win32
+#endif //win32
Please sign in to comment.
Something went wrong with that request. Please try again.