diff --git a/Atom-Linux/Makefile b/Atom-Linux/Makefile index 77a042faa..3aabc7dae 100644 --- a/Atom-Linux/Makefile +++ b/Atom-Linux/Makefile @@ -12,15 +12,19 @@ CXXFLAGS := -Werror \ -fPIC \ -pthread \ -D_REENTRANT \ + -I/usr/include/glib-2.0 \ + -I/usr/lib/i386-linux-gnu/glib-2.0/include \ -I/usr/include/gtk-2.0 \ - -I/usr/lib/gtk-2.0/include \ + -I/usr/lib/i386-linux-gnu/gtk-2.0/include \ -I/usr/include/atk-1.0 \ -I/usr/include/cairo \ + -I/usr/include/gdk-pixbuf-2.0 \ -I/usr/include/pango-1.0 \ -I/usr/include/gio-unix-2.0/ \ - -I/usr/include/glib-2.0 \ + -I/usr/include/pixman-1 \ + -I/usr/include/freetype2 \ + -I/usr/include/libpng12 \ -I/usr/include/openssl \ - -I/usr/lib/glib-2.0/include \ -I../cef \ -O2 \ -fno-ident \ @@ -85,7 +89,6 @@ install: cp -R ../vendor $(INSTALLDIR) cp -R ../bundles $(INSTALLDIR) cp -R ../themes $(INSTALLDIR) - cp ../index.html $(INSTALLDIR) coffee -c -o $(INSTALLDIR)/src/stdlib ../src/stdlib/require.coffee ln -sf $(INSTALLDIR)/atom /usr/local/bin/atom diff --git a/Atom-Linux/atom.cpp b/Atom-Linux/atom.cpp index 3457166fc..9e684d616 100644 --- a/Atom-Linux/atom.cpp +++ b/Atom-Linux/atom.cpp @@ -31,8 +31,6 @@ void AppGetSettings(CefSettings& settings, CefRefPtr& app) { CefString(&settings.javascript_flags) = ""; settings.log_severity = LOGSEVERITY_ERROR; - settings.local_storage_quota = 0; - settings.session_storage_quota = 0; } void destroy(void) { @@ -47,13 +45,14 @@ void TerminationSignalHandler(int signatl) { static gboolean HandleFocus(GtkWidget* widget, GdkEventFocus* focus) { if (g_handler.get() && g_handler->GetBrowserHwnd()) { // Give focus to the browser window. - g_handler->GetBrowser()->SetFocus(true); + g_handler->GetBrowser()->GetHost()->SetFocus(true); } return TRUE; } int main(int argc, char *argv[]) { + CefMainArgs main_args(argc, argv); szWorkingDir = get_current_dir_name(); if (szWorkingDir == NULL) return -1; @@ -84,7 +83,7 @@ int main(int argc, char *argv[]) { CefRefPtr app; AppGetSettings(settings, app); - CefInitialize(settings, app); + CefInitialize(main_args, settings, app.get()); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "atom"); @@ -112,15 +111,16 @@ int main(int argc, char *argv[]) { window_info.SetAsChild(vbox); - std::string path = io_utils_real_app_path("/index.html"); + std::string path = io_utils_real_app_path("/static/index.html"); if (path.empty()) return -1; std::string resolved("file://"); resolved.append(path); - CefBrowser::CreateBrowserSync(window_info, - static_cast >(g_handler), resolved, browserSettings); + CefBrowserHost::CreateBrowserSync( + window_info, g_handler.get(), + resolved, browserSettings); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show_all(GTK_WIDGET(window)); diff --git a/Atom-Linux/client_handler.cpp b/Atom-Linux/client_handler.cpp index 7794d6ad2..833ad8da9 100644 --- a/Atom-Linux/client_handler.cpp +++ b/Atom-Linux/client_handler.cpp @@ -27,17 +27,17 @@ void ClientHandler::OnAfterCreated(CefRefPtr browser) { REQUIRE_UI_THREAD(); AutoLock lock_scope(this); - if (!m_Browser.get()) { + if (!m_Browser.get()) { // We need to keep the main child window, but not popup windows m_Browser = browser; - m_BrowserHwnd = browser->GetWindowHandle(); + m_BrowserId = browser->GetIdentifier(); } } bool ClientHandler::DoClose(CefRefPtr browser) { REQUIRE_UI_THREAD(); - if (m_BrowserHwnd == browser->GetWindowHandle()) { + if (m_BrowserId == browser->GetIdentifier()) { // Since the main window contains the browser window, we need to close // the parent window instead of the browser window. CloseMainWindow(); @@ -56,9 +56,15 @@ bool ClientHandler::DoClose(CefRefPtr browser) { void ClientHandler::OnBeforeClose(CefRefPtr browser) { REQUIRE_UI_THREAD(); - if (m_BrowserHwnd == browser->GetWindowHandle()) { + if (m_BrowserId == browser->GetIdentifier()) { // Free the browser pointer so that the browser can be destroyed m_Browser = NULL; + } else if (browser->IsPopup()) { + // Remove the record for DevTools popup windows. + //std::set::iterator it = + // m_OpenDevToolsURLs.find(browser->GetMainFrame()->GetURL()); + //if (it != m_OpenDevToolsURLs.end()) + // m_OpenDevToolsURLs.erase(it); } } @@ -66,7 +72,7 @@ void ClientHandler::OnLoadStart(CefRefPtr browser, CefRefPtr frame) { REQUIRE_UI_THREAD(); - if (m_BrowserHwnd == browser->GetWindowHandle() && frame->IsMain()) { + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { CefRefPtr context = frame->GetV8Context(); CefRefPtr global = context->GetGlobal(); context->Enter(); @@ -86,7 +92,7 @@ void ClientHandler::OnLoadStart(CefRefPtr browser, m_nativeHandler->window = window; m_nativeHandler->path = path; - CefRefPtr atom = CefV8Value::CreateObject(NULL, NULL); + CefRefPtr atom = CefV8Value::CreateObject(NULL); global->SetValue("atom", atom, V8_PROPERTY_ATTRIBUTE_NONE); CefRefPtr loadPath = CefV8Value::CreateString(AppPath()); @@ -152,52 +158,6 @@ void ClientHandler::OnFocusedNodeChanged(CefRefPtr browser, REQUIRE_UI_THREAD(); } -bool ClientHandler::OnKeyEvent(CefRefPtr browser, KeyEventType type, - int code, int modifiers, bool isSystemKey, bool isAfterJavaScript) { - REQUIRE_UI_THREAD(); - - return false; -} - -bool ClientHandler::GetPrintHeaderFooter(CefRefPtr browser, - CefRefPtr frame, const CefPrintInfo& printInfo, - const CefString& url, const CefString& title, int currentPage, int maxPages, - CefString& topLeft, CefString& topCenter, CefString& topRight, - CefString& bottomLeft, CefString& bottomCenter, CefString& bottomRight) { - REQUIRE_UI_THREAD(); - - // Place the page title at top left - topLeft = title; - // Place the page URL at top right - topRight = url; - - // Place "Page X of Y" at bottom center - std::stringstream strstream; - strstream << "Page " << currentPage << " of " << maxPages; - bottomCenter = strstream.str(); - - return false; -} - -void ClientHandler::OnContextCreated(CefRefPtr browser, - CefRefPtr frame, CefRefPtr context) { - REQUIRE_UI_THREAD(); -} - -bool ClientHandler::OnDragStart(CefRefPtr browser, - CefRefPtr dragData, DragOperationsMask mask) { - REQUIRE_UI_THREAD(); - - return false; -} - -bool ClientHandler::OnDragEnter(CefRefPtr browser, - CefRefPtr dragData, DragOperationsMask mask) { - REQUIRE_UI_THREAD(); - - return false; -} - void ClientHandler::SetWindow(GtkWidget* widget) { window = widget; } @@ -250,7 +210,7 @@ void ClientHandler::OnTitleChange(CefRefPtr browser, formatted.append(" - atom"); GtkWidget* window = gtk_widget_get_ancestor( - GTK_WIDGET(browser->GetWindowHandle()), GTK_TYPE_WINDOW); + GTK_WIDGET(browser->GetHost()->GetWindowHandle()), GTK_TYPE_WINDOW); gtk_window_set_title(GTK_WINDOW(window), formatted.c_str()); } diff --git a/Atom-Linux/client_handler.h b/Atom-Linux/client_handler.h index c45dba015..b7eafd1fe 100644 --- a/Atom-Linux/client_handler.h +++ b/Atom-Linux/client_handler.h @@ -13,11 +13,7 @@ class ClientHandler: public CefClient, public CefLifeSpanHandler, public CefLoadHandler, public CefDisplayHandler, - public CefFocusHandler, - public CefKeyboardHandler, - public CefPrintHandler, - public CefV8ContextHandler, - public CefDragHandler { + public CefFocusHandler { public: ClientHandler(); virtual ~ClientHandler(); @@ -35,18 +31,6 @@ public: virtual CefRefPtr GetFocusHandler() OVERRIDE { return this; } - virtual CefRefPtr GetKeyboardHandler() OVERRIDE { - return this; - } - virtual CefRefPtr GetPrintHandler() OVERRIDE { - return this; - } - virtual CefRefPtr GetV8ContextHandler() OVERRIDE { - return this; - } - virtual CefRefPtr GetDragHandler() OVERRIDE { - return this; - } // CefLifeSpanHandler methods virtual bool OnBeforePopup(CefRefPtr parentBrowser, @@ -80,29 +64,6 @@ public: virtual void OnFocusedNodeChanged(CefRefPtr browser, CefRefPtr frame, CefRefPtr node) OVERRIDE; - // CefKeyboardHandler methods. - virtual bool OnKeyEvent(CefRefPtr browser, KeyEventType type, - int code, int modifiers, bool isSystemKey, bool isAfterJavaScript) - OVERRIDE; - - // CefPrintHandler methods. - virtual bool GetPrintHeaderFooter(CefRefPtr browser, - CefRefPtr frame, const CefPrintInfo& printInfo, - const CefString& url, const CefString& title, int currentPage, - int maxPages, CefString& topLeft, CefString& topCenter, - CefString& topRight, CefString& bottomLeft, CefString& bottomCenter, - CefString& bottomRight) OVERRIDE; - - // CefV8ContextHandler methods - virtual void OnContextCreated(CefRefPtr browser, - CefRefPtr frame, CefRefPtr context) OVERRIDE; - - // CefDragHandler methods. - virtual bool OnDragStart(CefRefPtr browser, - CefRefPtr dragData, DragOperationsMask mask) OVERRIDE; - virtual bool OnDragEnter(CefRefPtr browser, - CefRefPtr dragData, DragOperationsMask mask) OVERRIDE; - void SetWindow(GtkWidget* window); void SetMainHwnd(CefWindowHandle hwnd); CefWindowHandle GetMainHwnd() { @@ -141,6 +102,9 @@ protected: // The edit window handle CefWindowHandle m_EditHwnd; + // The child browser id + int m_BrowserId; + // Support for logging. std::string m_LogFile; diff --git a/Atom-Linux/lib/libcef.so b/Atom-Linux/lib/libcef.so index f6e77b31f..9c22903b7 100755 Binary files a/Atom-Linux/lib/libcef.so and b/Atom-Linux/lib/libcef.so differ diff --git a/Atom-Linux/lib/libcef_dll_wrapper.a b/Atom-Linux/lib/libcef_dll_wrapper.a index c0c1e53dc..c2355da67 100644 Binary files a/Atom-Linux/lib/libcef_dll_wrapper.a and b/Atom-Linux/lib/libcef_dll_wrapper.a differ diff --git a/Atom-Linux/native_handler.cpp b/Atom-Linux/native_handler.cpp index 4ed2dd25a..1b8c1cdad 100644 --- a/Atom-Linux/native_handler.cpp +++ b/Atom-Linux/native_handler.cpp @@ -43,7 +43,7 @@ void ExecuteWatchCallback(NotifyContext notifyContext) { CefRefPtr retval; CefRefPtr e; args.push_back(callbackContext.eventTypes); - function->ExecuteFunction(function, args, retval, e, true); + function->ExecuteFunction(retval, args); context->Exit(); } @@ -206,7 +206,7 @@ void NativeHandler::List(const CefString& name, CefRefPtr object, vector < string > *paths = new vector; ListDirectory(path, paths, recursive); - retval = CefV8Value::CreateArray(); + retval = CefV8Value::CreateArray(paths->size()); for (uint i = 0; i < paths->size(); i++) retval->SetValue(i, CefV8Value::CreateString(paths->at(i))); free (paths); @@ -294,13 +294,13 @@ void NativeHandler::AsyncList(const CefString& name, vector < string > *paths = new vector; ListDirectory(path, paths, recursive); - CefRefPtr callbackPaths = CefV8Value::CreateArray(); + CefRefPtr callbackPaths = CefV8Value::CreateArray(paths->size()); for (uint i = 0; i < paths->size(); i++) callbackPaths->SetValue(i, CefV8Value::CreateString(paths->at(i))); CefV8ValueList args; args.push_back(callbackPaths); CefRefPtr e; - arguments[2]->ExecuteFunction(arguments[2], args, retval, e, true); + arguments[2]->ExecuteFunction(retval, args); if (e) exception = e->GetMessage(); free (paths); @@ -342,7 +342,7 @@ void NativeHandler::Alert(const CefString& name, CefRefPtr object, CefString& exception) { CefRefPtr buttonNamesAndCallbacks; if (arguments.size() < 3) - buttonNamesAndCallbacks = CefV8Value::CreateArray(); + buttonNamesAndCallbacks = CefV8Value::CreateArray(0); else buttonNamesAndCallbacks = arguments[2]; @@ -373,7 +373,7 @@ void NativeHandler::Alert(const CefString& name, CefRefPtr object, buttonNamesAndCallbacks->GetValue(result)->GetValue(1); CefV8ValueList args; CefRefPtr e; - callback->ExecuteFunction(callback, args, retval, e, true); + callback->ExecuteFunction(retval, args); if (e) exception = e->GetMessage(); } @@ -392,7 +392,7 @@ void NativeHandler::WatchPath(const CefString& name, CallbackContext callbackContext; callbackContext.context = CefV8Context::GetCurrentContext(); callbackContext.function = arguments[1]; - CefRefPtr eventTypes = CefV8Value::CreateObject(NULL, NULL); + CefRefPtr eventTypes = CefV8Value::CreateObject(NULL); eventTypes->SetValue("modified", CefV8Value::CreateBool(true), V8_PROPERTY_ATTRIBUTE_NONE); callbackContext.eventTypes = eventTypes; @@ -488,8 +488,8 @@ bool NativeHandler::Execute(const CefString& name, CefRefPtr object, IsFile(name, object, arguments, retval, exception); else if (name == "isDirectory") IsDirectory(name, object, arguments, retval, exception); - else if (name == "showDevTools") - CefV8Context::GetCurrentContext()->GetBrowser()->ShowDevTools(); +// else if (name == "showDevTools") +// CefV8Context::GetCurrentContext()->GetBrowser()->ShowDevTools(); else if (name == "openDialog") OpenDialog(name, object, arguments, retval, exception); else if (name == "open") diff --git a/Atom-Linux/onig_regexp_extension.cpp b/Atom-Linux/onig_regexp_extension.cpp index 686fe9f2f..949b2b84b 100644 --- a/Atom-Linux/onig_regexp_extension.cpp +++ b/Atom-Linux/onig_regexp_extension.cpp @@ -55,8 +55,8 @@ public: return CefV8Value::CreateNull(); CefRefPtr indices; - CefRefPtr resultArray = CefV8Value::CreateArray(); - CefRefPtr indicesArray = CefV8Value::CreateArray(); + CefRefPtr resultArray = CefV8Value::CreateArray(region->num_regs); + CefRefPtr indicesArray = CefV8Value::CreateArray(region->num_regs); for (int i = 0; i < region->num_regs; i++) { int begin = region->beg[i]; int end = region->end[i]; @@ -95,7 +95,7 @@ public: } CefRefPtr BuildCaptureIndices(OnigRegion *region) { - CefRefPtr array = CefV8Value::CreateArray(); + CefRefPtr array = CefV8Value::CreateArray(region->num_regs); int i = 0; for (int index = 0; index < region->num_regs; index++) { int begin = region->beg[index]; @@ -170,7 +170,8 @@ bool OnigRegexpExtension::Execute(const CefString& name, if (name == "buildOnigRegExp") { CefRefPtr userData = new OnigRegexpUserData(arguments[0]); - retval = CefV8Value::CreateObject(userData, NULL); + retval = CefV8Value::CreateObject(NULL); + retval->SetUserData(userData); return true; }