Page 1 of 1

Integrating CEF Framework in MAC App

PostPosted: Thu Apr 09, 2015 10:59 am
by rashid301
Hi, i have an app which is built using make. I am trying to integrate CEF framework with it. It used to work before(done by some other developer). However after updating CEF it has stopped working.
Current Makefile has the following
LIBCEF_DLL_SOURCE=$(CEF_DIR)/libcef_dll
175 LIBCEF_DLLWRAPPER_SOURCE=$(LIBCEF_DLL_SOURCE)/wrapper
176 CFLAGS += -I$(THIRD_PARTY_INCLUDE)/libcef -I$(THIRD_PARTY_INCLUDE)/libcef/include
177
178 $(OBJ)/%.o: $(LIBCEF_DLLWRAPPER_SOURCE)/%.cc
179 › $(CXX) $(CFLAGS) -c -o $@ $<
180
181 CEF_DLL_WRAPPER_OBJS += $(foreach file,$(wildcard $(LIBCEF_DLLWRAPPER_SOURCE)/*.cc), $(OBJ)/$(basename $(notdir $(file))).o)
182
183 $(OBJ)/%.o: $(LIBCEF_DLL_SOURCE)/%.cpp
184 › $(CXX) $(CFLAGS) -c -o $@ $<
185
186 CEF_DLL_WRAPPER_OBJS += $(foreach file,$(wildcard $(LIBCEF_DLL_SOURCE)/*.cpp), $(OBJ)/$(basename $(notdir $(file))).o)
187
188 $(OBJ)/%.o: $(LIBCEF_DLL_SOURCE)/ctocpp/%.cc
189 › $(CXX) $(CFLAGS) -c -o $@ $<
190
191 $(OBJ)/%.o: $(LIBCEF_DLL_SOURCE)/cpptoc/%.cc
192 › $(CXX) $(CFLAGS) -c -o $@ $<
193
194 $(OBJ)/%.o: $(LIBCEF_DLL_SOURCE)/base/%.cc
195 › $(CXX) $(CFLAGS) -c -o $@ $<
196
197 CEF_DLL_WRAPPER_OBJS += $(foreach file,$(wildcard $(LIBCEF_DLL_SOURCE)/*/*.cc), $(OBJ)/$(basename $(notdir $(file))).o)

I was getting error dyld"@executable_path/Chromium Embedded Framework" not found. After researching I added the following target in makfile to update path
+ › cp -Rf "$(CEF_DIR)/Release/Chromium Embedded Framework.framework" (app_path).app/Contents/Frameworks
+
+ › install_name_tool -change "@executable_path/Chromium Embedded Framework" "@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/C hromium Embedded Framework" "(help_app_path).app/Contents/MacOS/Cortext Helper"
+
+ › install_name_tool -change "@executable_path/Chromium Embedded Framework" "@executable_path/../Frameworks/Chromium Embedded Framework.framework/Chromium E mbedded Framework" "(app_path).app/Contents/MacOS/(target)"

However now I am getting a different error. Please see the attached file.
Can you help with the error or let me know the correct way of using the framework.
P.S: we are using 32 bit CEF(no longer supported).

Re: Integrating CEF Framework in MAC App

PostPosted: Mon Apr 13, 2015 10:36 am
by rashid301
After doing some debugging, I found the piece of code that was throwing the error. However I am not able to figure how to fix it. In client_handler_mac.mm there is this piece of code
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& url) {
CEF_REQUIRE_UI_THREAD();

if (GetBrowserId() == browser->GetIdentifier() && frame->IsMain()) {
// Set the edit window text
NSTextField* textField = (NSTextField*)edit_handle_;
std::string urlStr(url);
NSString* str = [NSString stringWithUTF8String:urlStr.c_str()];
[textField setStringValue:str];
}
}

On the last line, the error is thrown, I have checked repeatedly. None of the arguments are Null. However I am missing something that is causing the last line to break. Commenting out this piece of code, makes everything work fine. Could anyone please guide me, what could be missing because of which I am getting this error.

Re: Integrating CEF Framework in MAC App

PostPosted: Wed Apr 15, 2015 4:37 pm
by rashid301
Can anyone please help me here.
I just cant figure out how to get this working.
I have tried setting up handle EditHandle using
Code: Select all
client_handler->SetEditWindowHandle

still it is not working.

What else is required to pass this. Ideally I don't need address change text field. Hence I never added it. but now even after adding it does not seem to work.

Re: Integrating CEF Framework in MAC App

PostPosted: Thu Apr 16, 2015 4:12 am
by magreenblatt
Delete the contents of the OnAddressChange method if you don't want it to do anything.